Subversion Repositories eFlore/Applications.cel

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
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»
15
ALTER TABLE `cel_images` ADD `date_transmission` DATETIME NOT NULL AFTER `date_liaison`;
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
2418 jpm 21
UPDATE cel_images, cel_obs_images
2428 jpm 22
SET cel_images.ce_observation = cel_obs_images.id_observation,
23
	cel_images.date_liaison = cel_obs_images.date_liaison
2418 jpm 24
WHERE  cel_images.id_image = cel_obs_images.id_image
25
AND cel_obs_images.id_image != '0';
26
 
2427 jpm 27
-- Ajout index sur ce_observation
2418 jpm 28
CREATE INDEX ce_observation ON cel_images (ce_observation);
29
 
2428 jpm 30
-- Mise à jour du champ «transmission» de la table «cel_images» à partir des données de «cel_obs»
2418 jpm 31
UPDATE cel_images, cel_obs
2428 jpm 32
SET cel_images.transmission = cel_obs.transmission,
33
	cel_images.date_transmission = cel_obs.date_transmission
2418 jpm 34
WHERE  cel_images.ce_observation = cel_obs.id_observation
35
AND (cel_images.ce_observation IS NOT NULL OR cel_images.ce_observation != 0);
36
 
2427 jpm 37
-- Suppression de la table cel_obs_image inutile
2428 jpm 38
DROP TABLE cel_obs_images;
39
 
40
-- -----------------------------------------------------
41
SET SQL_MODE=@OLD_SQL_MODE;
42
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
43
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;