db-update-2016-06-27.sql 744 Bytes
use database;

ALTER TABLE `documents` ADD `type_document_id` int(11) DEFAULT 1;

CREATE TABLE IF NOT EXISTS `type_documents` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `nom` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`)
);

ALTER TABLE `documents` ADD CONSTRAINT `fk_documents_type_documents_id` FOREIGN KEY (`type_document_id`) REFERENCES `type_documents` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;

ALTER TABLE `documents` DROP `chemin`;
ALTER TABLE `documents` DROP `description`;

ALTER TABLE `documents` ADD `description` text DEFAULT NULL;
ALTER TABLE `documents` ADD `nom` VARCHAR(100) DEFAULT NULL;


DROP TABLE IF EXISTS `fichiers`;
DROP TABLE IF EXISTS `utilisateurs`;

Insert into type_documents(id, nom) values (1, 'N/A');