2428 |
jpm |
1 |
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
|
|
|
2 |
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
|
|
|
3 |
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
|
|
|
4 |
|
2427 |
jpm |
5 |
-- Supprime le champ «publiable_eflore»
|
|
|
6 |
ALTER TABLE `cel_images` DROP `publiable_eflore` ;
|
2418 |
jpm |
7 |
|
2427 |
jpm |
8 |
-- Ajoute le champ «transmission» dans «cel_images»
|
|
|
9 |
ALTER TABLE `cel_images` ADD `transmission` TINYINT(1) NOT NULL DEFAULT '1' AFTER `meta_autres`;
|
|
|
10 |
|
|
|
11 |
-- Ajoute le champ «date_liaison» dans «cel_images»
|
2418 |
jpm |
12 |
ALTER TABLE `cel_images` ADD `date_liaison` DATETIME NOT NULL AFTER `date_creation`;
|
|
|
13 |
|
2427 |
jpm |
14 |
-- Ajoute le champ «date_transmission» dans «cel_images»
|
2466 |
aurelien |
15 |
ALTER TABLE `cel_images` ADD `date_transmission` DATETIME NULL AFTER `date_liaison`;
|
2427 |
jpm |
16 |
|
|
|
17 |
-- Ajoute le champ «ce_observation» dans «cel_images»
|
2418 |
jpm |
18 |
ALTER TABLE `cel_images` ADD `ce_observation` BIGINT NULL AFTER `id_image`;
|
|
|
19 |
|
2427 |
jpm |
20 |
-- Met à jour la table cel_image avec les données de cel_obs_images
|
2435 |
jpm |
21 |
START TRANSACTION;
|
2418 |
jpm |
22 |
UPDATE cel_images, cel_obs_images
|
2428 |
jpm |
23 |
SET cel_images.ce_observation = cel_obs_images.id_observation,
|
|
|
24 |
cel_images.date_liaison = cel_obs_images.date_liaison
|
2418 |
jpm |
25 |
WHERE cel_images.id_image = cel_obs_images.id_image
|
|
|
26 |
AND cel_obs_images.id_image != '0';
|
2435 |
jpm |
27 |
COMMIT;
|
2418 |
jpm |
28 |
|
2427 |
jpm |
29 |
-- Ajout index sur ce_observation
|
2418 |
jpm |
30 |
CREATE INDEX ce_observation ON cel_images (ce_observation);
|
|
|
31 |
|
2428 |
jpm |
32 |
-- Mise à jour du champ «transmission» de la table «cel_images» à partir des données de «cel_obs»
|
2435 |
jpm |
33 |
START TRANSACTION;
|
2418 |
jpm |
34 |
UPDATE cel_images, cel_obs
|
2428 |
jpm |
35 |
SET cel_images.transmission = cel_obs.transmission,
|
|
|
36 |
cel_images.date_transmission = cel_obs.date_transmission
|
2418 |
jpm |
37 |
WHERE cel_images.ce_observation = cel_obs.id_observation
|
|
|
38 |
AND (cel_images.ce_observation IS NOT NULL OR cel_images.ce_observation != 0);
|
2435 |
jpm |
39 |
COMMIT;
|
2418 |
jpm |
40 |
|
2427 |
jpm |
41 |
-- Suppression de la table cel_obs_image inutile
|
2435 |
jpm |
42 |
RENAME TABLE cel_obs_images TO cel_obs_images_obsolete;
|
2428 |
jpm |
43 |
|
|
|
44 |
-- -----------------------------------------------------
|
|
|
45 |
SET SQL_MODE=@OLD_SQL_MODE;
|
|
|
46 |
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
|
2466 |
aurelien |
47 |
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|