use database; set foreign_key_checks=0; ALTER TABLE `documents` ADD `type_document_id` int(11) DEFAULT NULL; 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');