diff --git a/database/update/script_sql/db-update-2016-06-27.sql b/database/update/script_sql/db-update-2016-06-27.sql index 9509896..cdc92a1 100755 --- a/database/update/script_sql/db-update-2016-06-27.sql +++ b/database/update/script_sql/db-update-2016-06-27.sql @@ -1,7 +1,6 @@ use database; -ALTER TABLE `documents` DROP `chemin`; -ALTER TABLE `documents` DROP `description`; +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, @@ -9,13 +8,16 @@ CREATE TABLE IF NOT EXISTS `type_documents` ( PRIMARY KEY (`id`) ); -Insert into type_documents(id, nom) values (1, 'N/A'); +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 `type_document_id` int(11) DEFAULT 1; ALTER TABLE `documents` ADD `description` text DEFAULT NULL; ALTER TABLE `documents` ADD `nom` VARCHAR(100) DEFAULT NULL; -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; DROP TABLE IF EXISTS `fichiers`; DROP TABLE IF EXISTS `utilisateurs`; + +Insert into type_documents(id, nom) values (1, 'N/A'); -- libgit2 0.21.2