Rev 2467 | Rev 2485 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
SET GLOBAL SQL_MODE = 'NO_ENGINE_SUBSTITUTION,ALLOW_INVALID_DATES';
-- Supprime le champ «publiable_eflore»
ALTER TABLE `cel_images` DROP `publiable_eflore` ;
-- Ajoute le champ «transmission» dans «cel_images»
ALTER TABLE `cel_images` ADD `transmission` TINYINT(1) NOT NULL DEFAULT '1' AFTER `meta_autres`;
-- Ajoute le champ «date_liaison» dans «cel_images»
ALTER TABLE `cel_images` ADD `date_liaison` DATETIME NOT NULL AFTER `date_creation`;
-- Ajoute le champ «date_transmission» dans «cel_images»
ALTER TABLE `cel_images` ADD `date_transmission` DATETIME NULL AFTER `date_liaison`;
-- Ajoute le champ «ce_observation» dans «cel_images»
ALTER TABLE `cel_images` ADD `ce_observation` BIGINT NULL AFTER `id_image`;
-- Met à jour la table cel_image avec les données de cel_obs_images
START TRANSACTION;
UPDATE cel_images, cel_obs_images
SET cel_images.ce_observation = cel_obs_images.id_observation,
cel_images.date_liaison = cel_obs_images.date_liaison
WHERE cel_images.id_image = cel_obs_images.id_image
AND cel_obs_images.id_image != '0';
COMMIT;
-- Ajout index sur ce_observation
CREATE INDEX ce_observation ON cel_images (ce_observation);
-- Mise à jour du champ «transmission» de la table «cel_images» à partir des données de «cel_obs»
START TRANSACTION;
UPDATE cel_images, cel_obs
SET cel_images.transmission = cel_obs.transmission,
cel_images.date_transmission = cel_obs.date_transmission
WHERE cel_images.ce_observation = cel_obs.id_observation
AND (cel_images.ce_observation IS NOT NULL OR cel_images.ce_observation != 0);
COMMIT;
-- Suppression de la table cel_obs_image inutile
RENAME TABLE cel_obs_images TO cel_obs_images_obsolete;
-- -----------------------------------------------------
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;