db-update-2016-06-07.sql
854 Bytes
use database;
-- On execute TOUT ou RIEN
START TRANSACTION;
DROP TABLE IF EXISTS `documents`;
CREATE TABLE IF NOT EXISTS `documents` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`type_doc` varchar(20) DEFAULT NULL,
`description` varchar(100) DEFAULT NULL,
`chemin` varchar(100) DEFAULT NULL,
`materiel_id` int(11) DEFAULT NULL,
`suivi_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_documents_materiel_id` (`materiel_id`),
KEY `fk_documents_suivi_id` (`suivi_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
ALTER TABLE `documents`
ADD CONSTRAINT `fk_documents_materiel_id` FOREIGN KEY (`materiel_id`) REFERENCES `materiels` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_documents_suivi_id` FOREIGN KEY (`suivi_id`) REFERENCES `suivis` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
COMMIT;