use database;

-- On execute TOUT ou RIEN
START TRANSACTION;

ALTER TABLE `configurations` ADD `emailGuest6` varchar(45)  DEFAULT NULL;
ALTER TABLE `configurations` ADD `emailGuest7` varchar(45)  DEFAULT NULL;
ALTER TABLE `configurations` ADD `emailGuest8` varchar(45)  DEFAULT NULL;
ALTER TABLE `configurations` ADD `emailGuest9` varchar(45)  DEFAULT NULL;
ALTER TABLE `configurations` ADD `emailGuest10` varchar(45)  DEFAULT NULL;

update emprunts set date_emprunt = NULL where date_emprunt = '1970-01-01';
update emprunts set date_retour_emprunt = NULL where date_retour_emprunt = '1970-01-01';

update suivis set date_controle = NULL where date_controle = '1970-01-01';
update suivis set date_prochain_controle = NULL where date_prochain_controle = '1970-01-01';

update materiels set date_acquisition = NULL where date_acquisition = '1970-01-01';
update materiels set date_archivage = NULL where date_archivage = '1970-01-01';
update materiels set date_reception = NULL where date_reception = '1970-01-01';

ALTER TABLE `configurations` ADD `host2_ldap` text DEFAULT NULL;
update configurations set host2_ldap = host_ldap where id = 1;
ALTER TABLE `configurations` DROP `host_ldap`;
ALTER TABLE `configurations` ADD `host_ldap` text DEFAULT NULL;
update configurations set host_ldap = host2_ldap where id = 1;
ALTER TABLE `configurations` DROP `host2_ldap`;

COMMIT;