1267 |
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';
|
692 |
gduche |
4 |
|
|
|
5 |
|
1267 |
jpm |
6 |
-- -----------------------------------------------------
|
|
|
7 |
-- Table `del_utilisateur_infos`
|
|
|
8 |
-- -----------------------------------------------------
|
|
|
9 |
DROP TABLE IF EXISTS `del_utilisateur_infos` ;
|
692 |
gduche |
10 |
|
1267 |
jpm |
11 |
CREATE TABLE IF NOT EXISTS `del_utilisateur_infos` (
|
|
|
12 |
`id_utilisateur` INT(11) NOT NULL ,
|
|
|
13 |
`admin` TINYINT(1) NULL ,
|
|
|
14 |
`preferences` LONGTEXT NULL ,
|
|
|
15 |
`date_premiere_utilisation` DATETIME NULL ,
|
|
|
16 |
PRIMARY KEY (`id_utilisateur`) )
|
|
|
17 |
ENGINE = MyISAM;
|
692 |
gduche |
18 |
|
|
|
19 |
|
1267 |
jpm |
20 |
-- -----------------------------------------------------
|
|
|
21 |
-- Table `del_utilisateur`
|
|
|
22 |
-- -----------------------------------------------------
|
|
|
23 |
DROP TABLE IF EXISTS `del_utilisateur` ;
|
692 |
gduche |
24 |
|
1267 |
jpm |
25 |
CREATE TABLE IF NOT EXISTS `del_utilisateur` (
|
1272 |
jpm |
26 |
`id_utilisateur` INT NOT NULL AUTO_INCREMENT COMMENT 'Type varchar pour éviter problème de jointure.' ,
|
1267 |
jpm |
27 |
`prenom` VARCHAR(255) NOT NULL ,
|
|
|
28 |
`nom` VARCHAR(255) NOT NULL ,
|
|
|
29 |
`courriel` VARCHAR(255) NOT NULL ,
|
|
|
30 |
`mot_de_passe` VARCHAR(45) NULL DEFAULT NULL ,
|
|
|
31 |
PRIMARY KEY (`id_utilisateur`) )
|
|
|
32 |
ENGINE = MyISAM
|
|
|
33 |
DEFAULT CHARACTER SET = utf8
|
|
|
34 |
COLLATE = utf8_general_ci;
|
692 |
gduche |
35 |
|
|
|
36 |
|
1267 |
jpm |
37 |
-- -----------------------------------------------------
|
|
|
38 |
-- Table `del_image`
|
|
|
39 |
-- -----------------------------------------------------
|
|
|
40 |
DROP TABLE IF EXISTS `del_image` ;
|
692 |
gduche |
41 |
|
1267 |
jpm |
42 |
CREATE TABLE IF NOT EXISTS `del_image` (
|
|
|
43 |
`id_image` BIGINT NOT NULL AUTO_INCREMENT ,
|
|
|
44 |
`ce_utilisateur` INT NOT NULL ,
|
|
|
45 |
`hauteur` INT NULL ,
|
|
|
46 |
`largeur` INT NULL ,
|
|
|
47 |
`date_prise_de_vue` DATETIME NULL ,
|
|
|
48 |
`mots_cles_texte` LONGTEXT NULL DEFAULT NULL ,
|
|
|
49 |
`commentaire` LONGTEXT NULL DEFAULT NULL ,
|
|
|
50 |
`nom_original` VARCHAR(255) NOT NULL ,
|
|
|
51 |
`date_creation` DATETIME NOT NULL ,
|
|
|
52 |
`date_modification` DATETIME NOT NULL ,
|
|
|
53 |
`publiable_eflore` TINYINT(1) NOT NULL DEFAULT '1' ,
|
|
|
54 |
PRIMARY KEY (`id_image`) )
|
|
|
55 |
ENGINE = MyISAM
|
|
|
56 |
DEFAULT CHARACTER SET = utf8
|
|
|
57 |
COLLATE = utf8_general_ci;
|
692 |
gduche |
58 |
|
|
|
59 |
|
1267 |
jpm |
60 |
-- -----------------------------------------------------
|
|
|
61 |
-- Table `del_observation`
|
|
|
62 |
-- -----------------------------------------------------
|
|
|
63 |
DROP TABLE IF EXISTS `del_observation` ;
|
692 |
gduche |
64 |
|
1267 |
jpm |
65 |
CREATE TABLE IF NOT EXISTS `del_observation` (
|
|
|
66 |
`id_observation` BIGINT NOT NULL AUTO_INCREMENT ,
|
|
|
67 |
`ce_utilisateur` INT NOT NULL ,
|
|
|
68 |
`nom_sel` VARCHAR(255) NULL DEFAULT NULL COMMENT 'Nom scientifique sélectionné par l\'utilisateur.' ,
|
|
|
69 |
`nom_sel_nn` DECIMAL(9,0) NULL DEFAULT NULL COMMENT 'Identifiant du nom sélectionné.' ,
|
|
|
70 |
`nom_ret` VARCHAR(255) NULL DEFAULT NULL COMMENT 'Nom scientifique retenu correspondant au nom sélectionné.' ,
|
|
|
71 |
`nom_ret_nn` DECIMAL(9,0) NULL DEFAULT NULL COMMENT 'Identifiant du nom retenu.' ,
|
|
|
72 |
`nt` DECIMAL(9,0) NULL DEFAULT NULL COMMENT 'Numéro taxonomique du taxon correspondant au nom sélectionné.' ,
|
|
|
73 |
`famille` VARCHAR(255) NULL DEFAULT NULL COMMENT 'Nom de la famille du nom sélectionné.' ,
|
|
|
74 |
`nom_referentiel` VARCHAR(255) NULL DEFAULT NULL ,
|
|
|
75 |
`ce_zone_geo` VARCHAR(50) NULL DEFAULT NULL ,
|
|
|
76 |
`zone_geo` VARCHAR(255) NULL DEFAULT NULL ,
|
|
|
77 |
`lieudit` VARCHAR(255) NULL DEFAULT NULL ,
|
|
|
78 |
`station` VARCHAR(255) NULL DEFAULT NULL ,
|
|
|
79 |
`milieu` VARCHAR(255) NULL DEFAULT NULL ,
|
|
|
80 |
`date_observation` DATETIME NULL ,
|
|
|
81 |
`mots_cles_texte` LONGTEXT NULL DEFAULT NULL ,
|
|
|
82 |
`commentaire` TEXT NULL DEFAULT NULL ,
|
|
|
83 |
`date_creation` DATETIME NOT NULL ,
|
|
|
84 |
`date_modification` DATETIME NOT NULL ,
|
|
|
85 |
`date_transmission` DATETIME NOT NULL COMMENT 'Date à laquelle l\'observation a été rendu publique.' ,
|
|
|
86 |
PRIMARY KEY (`id_observation`) )
|
|
|
87 |
ENGINE = MyISAM
|
|
|
88 |
DEFAULT CHARACTER SET = utf8
|
|
|
89 |
COLLATE = utf8_general_ci
|
|
|
90 |
COMMENT = 'Observations publiques.';
|
692 |
gduche |
91 |
|
|
|
92 |
|
1267 |
jpm |
93 |
-- -----------------------------------------------------
|
|
|
94 |
-- Table `del_image_protocole`
|
|
|
95 |
-- -----------------------------------------------------
|
|
|
96 |
DROP TABLE IF EXISTS `del_image_protocole` ;
|
692 |
gduche |
97 |
|
1267 |
jpm |
98 |
CREATE TABLE IF NOT EXISTS `del_image_protocole` (
|
|
|
99 |
`id_protocole` INT NOT NULL AUTO_INCREMENT ,
|
|
|
100 |
`intitule` VARCHAR(255) NOT NULL ,
|
|
|
101 |
`descriptif` TEXT NULL ,
|
|
|
102 |
`tag` VARCHAR(255) NULL ,
|
|
|
103 |
PRIMARY KEY (`id_protocole`) )
|
|
|
104 |
ENGINE = MyISAM
|
|
|
105 |
DEFAULT CHARACTER SET = utf8
|
|
|
106 |
COLLATE = utf8_general_ci;
|
712 |
jpm |
107 |
|
|
|
108 |
|
1315 |
gduche |
109 |
-- Insérer un protocole par défaut ---------------------
|
|
|
110 |
INSERT INTO `del_image_protocole` (`id_protocole`, `intitule`, `descriptif`, `tag`) VALUES
|
|
|
111 |
(1, 'Protocole par défaut', 'Protocole par défaut', 'defaut');
|
|
|
112 |
|
1267 |
jpm |
113 |
-- -----------------------------------------------------
|
|
|
114 |
-- Table `del_image_vote`
|
|
|
115 |
-- -----------------------------------------------------
|
|
|
116 |
DROP TABLE IF EXISTS `del_image_vote` ;
|
712 |
jpm |
117 |
|
1267 |
jpm |
118 |
CREATE TABLE IF NOT EXISTS `del_image_vote` (
|
|
|
119 |
`id_vote` BIGINT NOT NULL AUTO_INCREMENT ,
|
|
|
120 |
`ce_image` BIGINT NOT NULL ,
|
|
|
121 |
`ce_protocole` INT NOT NULL ,
|
|
|
122 |
`ce_utilisateur` VARCHAR(32) NOT NULL COMMENT 'Identifiant de session ou id utilisateur.' ,
|
|
|
123 |
`valeur` TINYINT(1) NOT NULL ,
|
|
|
124 |
`date` DATETIME NOT NULL ,
|
|
|
125 |
PRIMARY KEY (`id_vote`) ,
|
|
|
126 |
UNIQUE INDEX `protocole_image_utilisateur` (`ce_image` ASC, `ce_protocole` ASC, `ce_utilisateur` ASC) )
|
|
|
127 |
ENGINE = MyISAM
|
|
|
128 |
DEFAULT CHARACTER SET = utf8
|
|
|
129 |
COLLATE = utf8_general_ci;
|
692 |
gduche |
130 |
|
|
|
131 |
|
1267 |
jpm |
132 |
-- -----------------------------------------------------
|
|
|
133 |
-- Table `del_image_tag`
|
|
|
134 |
-- -----------------------------------------------------
|
|
|
135 |
DROP TABLE IF EXISTS `del_image_tag` ;
|
692 |
gduche |
136 |
|
1267 |
jpm |
137 |
CREATE TABLE IF NOT EXISTS `del_image_tag` (
|
|
|
138 |
`id_tag` BIGINT NOT NULL AUTO_INCREMENT ,
|
|
|
139 |
`ce_image` BIGINT NOT NULL ,
|
|
|
140 |
`ce_utilisateur` VARCHAR(32) NOT NULL ,
|
|
|
141 |
`tag` VARCHAR(255) NOT NULL DEFAULT 'Mot clé saisi par l\'utilisateur.' ,
|
|
|
142 |
`tag_normalise` VARCHAR(255) NOT NULL DEFAULT 'Mot clé normalisé (sans espace ni accent).' ,
|
|
|
143 |
`date` DATETIME NOT NULL COMMENT 'Date de création du tag.' ,
|
|
|
144 |
`actif` INT(1) NULL ,
|
|
|
145 |
`date_modification` DATETIME NULL ,
|
|
|
146 |
PRIMARY KEY (`id_tag`) ,
|
|
|
147 |
INDEX `tag` (`tag` ASC) ,
|
|
|
148 |
INDEX `tag_normalise` (`tag_normalise` ASC) )
|
|
|
149 |
ENGINE = MyISAM
|
|
|
150 |
DEFAULT CHARACTER SET = utf8
|
|
|
151 |
COLLATE = utf8_general_ci;
|
692 |
gduche |
152 |
|
|
|
153 |
|
1267 |
jpm |
154 |
-- -----------------------------------------------------
|
|
|
155 |
-- Table `del_commentaire`
|
|
|
156 |
-- -----------------------------------------------------
|
|
|
157 |
DROP TABLE IF EXISTS `del_commentaire` ;
|
692 |
gduche |
158 |
|
1267 |
jpm |
159 |
CREATE TABLE IF NOT EXISTS `del_commentaire` (
|
|
|
160 |
`id_commentaire` BIGINT NOT NULL AUTO_INCREMENT ,
|
|
|
161 |
`ce_observation` BIGINT NOT NULL ,
|
|
|
162 |
`ce_proposition` INT NULL DEFAULT '0' ,
|
|
|
163 |
`ce_commentaire_parent` BIGINT NULL DEFAULT '0' ,
|
|
|
164 |
`texte` TEXT NULL DEFAULT NULL ,
|
|
|
165 |
`ce_utilisateur` INT NULL DEFAULT '0' ,
|
|
|
166 |
`utilisateur_prenom` VARCHAR(255) NOT NULL ,
|
|
|
167 |
`utilisateur_nom` VARCHAR(255) NOT NULL ,
|
|
|
168 |
`utilisateur_courriel` VARCHAR(255) NOT NULL ,
|
|
|
169 |
`nom_sel` VARCHAR(255) NULL DEFAULT NULL ,
|
|
|
170 |
`nom_sel_nn` DECIMAL(9,0) NULL DEFAULT NULL ,
|
|
|
171 |
`nom_ret` VARCHAR(255) NULL DEFAULT NULL ,
|
|
|
172 |
`nom_ret_nn` DECIMAL(9,0) NULL DEFAULT NULL ,
|
|
|
173 |
`nt` DECIMAL(9,0) NULL DEFAULT NULL ,
|
|
|
174 |
`famille` VARCHAR(255) NULL DEFAULT NULL ,
|
|
|
175 |
`nom_referentiel` VARCHAR(255) NULL DEFAULT NULL ,
|
|
|
176 |
`date` DATETIME NOT NULL COMMENT 'Date de création du commentaire.' ,
|
|
|
177 |
`proposition_initiale` INT(1) NOT NULL DEFAULT '0' ,
|
|
|
178 |
PRIMARY KEY (`id_commentaire`) )
|
|
|
179 |
ENGINE = MyISAM
|
|
|
180 |
DEFAULT CHARACTER SET = utf8
|
|
|
181 |
COLLATE = utf8_general_ci;
|
692 |
gduche |
182 |
|
|
|
183 |
|
1267 |
jpm |
184 |
-- -----------------------------------------------------
|
|
|
185 |
-- Table `del_commentaire_vote`
|
|
|
186 |
-- -----------------------------------------------------
|
|
|
187 |
DROP TABLE IF EXISTS `del_commentaire_vote` ;
|
1178 |
aurelien |
188 |
|
1267 |
jpm |
189 |
CREATE TABLE IF NOT EXISTS `del_commentaire_vote` (
|
|
|
190 |
`id_vote` BIGINT NOT NULL AUTO_INCREMENT ,
|
|
|
191 |
`ce_proposition` BIGINT NOT NULL ,
|
|
|
192 |
`ce_utilisateur` VARCHAR(32) NOT NULL DEFAULT '0' COMMENT 'Identifiant de session ou id de l\'utilisateur.' ,
|
|
|
193 |
`valeur` TINYINT(1) NOT NULL ,
|
|
|
194 |
`date` DATETIME NOT NULL ,
|
|
|
195 |
PRIMARY KEY (`id_vote`) )
|
|
|
196 |
ENGINE = MyISAM
|
|
|
197 |
DEFAULT CHARACTER SET = utf8
|
|
|
198 |
COLLATE = utf8_general_ci
|
|
|
199 |
COMMENT = 'Vote uniquement sur le commentaire de type \'proposition\'.';
|
1178 |
aurelien |
200 |
|
1213 |
aurelien |
201 |
|
1267 |
jpm |
202 |
-- -----------------------------------------------------
|
|
|
203 |
-- Table `del_obs_image`
|
|
|
204 |
-- -----------------------------------------------------
|
|
|
205 |
DROP TABLE IF EXISTS `del_obs_image` ;
|
1213 |
aurelien |
206 |
|
1267 |
jpm |
207 |
CREATE TABLE IF NOT EXISTS `del_obs_image` (
|
|
|
208 |
`id_image` BIGINT NOT NULL ,
|
|
|
209 |
`id_observation` BIGINT NOT NULL ,
|
|
|
210 |
`date_liaison` DATETIME NOT NULL ,
|
|
|
211 |
PRIMARY KEY (`id_image`, `id_observation`) )
|
|
|
212 |
ENGINE = MyISAM
|
|
|
213 |
DEFAULT CHARACTER SET = utf8
|
|
|
214 |
COLLATE = utf8_general_ci;
|
1213 |
aurelien |
215 |
|
1267 |
jpm |
216 |
|
|
|
217 |
-- -----------------------------------------------------
|
1270 |
jpm |
218 |
-- View `del_utilisateur`
|
1267 |
jpm |
219 |
-- -----------------------------------------------------
|
|
|
220 |
DROP VIEW IF EXISTS `del_utilisateur` ;
|
|
|
221 |
DROP TABLE IF EXISTS `del_utilisateur`;
|
|
|
222 |
DELIMITER $$
|
|
|
223 |
CREATE OR REPLACE VIEW del_utilisateur AS
|
1270 |
jpm |
224 |
SELECT
|
1272 |
jpm |
225 |
U_ID AS id_utilisateur,
|
1270 |
jpm |
226 |
CONVERT(U_SURNAME USING UTF8) AS prenom,
|
|
|
227 |
CONVERT(U_NAME USING UTF8) AS nom,
|
|
|
228 |
CONVERT(U_MAIL USING UTF8) AS courriel,
|
|
|
229 |
CONVERT(U_PASSWD USING UTF8) AS mot_de_passe
|
1267 |
jpm |
230 |
FROM tela_prod_v4.annuaire_tela;
|
|
|
231 |
$$
|
|
|
232 |
DELIMITER ;
|
|
|
233 |
|
|
|
234 |
;
|
|
|
235 |
|
|
|
236 |
-- -----------------------------------------------------
|
1270 |
jpm |
237 |
-- View `del_observation`
|
1267 |
jpm |
238 |
-- -----------------------------------------------------
|
|
|
239 |
DROP VIEW IF EXISTS `del_observation` ;
|
1213 |
aurelien |
240 |
DROP TABLE IF EXISTS `del_observation`;
|
1267 |
jpm |
241 |
DELIMITER $$
|
|
|
242 |
CREATE OR REPLACE VIEW del_observation AS
|
1308 |
jpm |
243 |
SELECT id_observation, if((char_length(o.ce_utilisateur) <> 32),cast(o.ce_utilisateur as unsigned),0) AS ce_utilisateur, prenom_utilisateur, nom_utilisateur, courriel_utilisateur, nom_sel, nom_sel_nn, nom_ret, nom_ret_nn, nt, famille,
|
1267 |
jpm |
244 |
ce_zone_geo, zone_geo, lieudit, station, milieu,
|
|
|
245 |
date_observation, mots_cles_texte, commentaire,
|
|
|
246 |
date_creation, date_modification, date_transmission
|
|
|
247 |
FROM tb_cel.cel_obs AS o
|
|
|
248 |
WHERE transmission = '1'
|
|
|
249 |
$$
|
|
|
250 |
DELIMITER ;
|
1213 |
aurelien |
251 |
|
1267 |
jpm |
252 |
;
|
1213 |
aurelien |
253 |
|
1267 |
jpm |
254 |
-- -----------------------------------------------------
|
1270 |
jpm |
255 |
-- View `del_image`
|
1267 |
jpm |
256 |
-- -----------------------------------------------------
|
|
|
257 |
DROP VIEW IF EXISTS `del_image` ;
|
|
|
258 |
DROP TABLE IF EXISTS `del_image`;
|
|
|
259 |
DELIMITER $$
|
|
|
260 |
CREATE OR REPLACE VIEW del_image AS
|
1308 |
jpm |
261 |
SELECT i.id_image, if((char_length(i.ce_utilisateur) <> 32),cast(i.ce_utilisateur as unsigned),0) AS ce_utilisateur, i.prenom_utilisateur, i.nom_utilisateur, i.courriel_utilisateur, i.hauteur, i.largeur, i.date_prise_de_vue, i.mots_cles_texte,
|
1267 |
jpm |
262 |
i.commentaire, i.nom_original, i.date_modification, i.date_creation, i.publiable_eflore
|
|
|
263 |
FROM tb_cel.cel_images AS i
|
|
|
264 |
INNER JOIN tb_cel.cel_obs_images AS oi ON (i.id_image = oi.id_image)
|
|
|
265 |
INNER JOIN tb_cel.cel_obs AS o ON (oi.id_observation = o.id_observation)
|
|
|
266 |
WHERE o.transmission = '1'
|
|
|
267 |
$$
|
|
|
268 |
DELIMITER ;
|
1213 |
aurelien |
269 |
|
1267 |
jpm |
270 |
;
|
|
|
271 |
|
|
|
272 |
-- -----------------------------------------------------
|
1272 |
jpm |
273 |
-- View `del_obs_image`
|
1267 |
jpm |
274 |
-- -----------------------------------------------------
|
|
|
275 |
DROP VIEW IF EXISTS `del_obs_image` ;
|
1213 |
aurelien |
276 |
DROP TABLE IF EXISTS `del_obs_image`;
|
1267 |
jpm |
277 |
DELIMITER $$
|
|
|
278 |
CREATE OR REPLACE VIEW del_obs_image AS
|
|
|
279 |
SELECT oi.id_image, oi.id_observation, oi.date_liaison
|
|
|
280 |
FROM tb_cel.cel_obs_images AS oi
|
|
|
281 |
INNER JOIN tb_cel.cel_obs AS o ON (oi.id_observation = o.id_observation)
|
|
|
282 |
WHERE o.transmission = '1'
|
|
|
283 |
$$
|
|
|
284 |
DELIMITER ;
|
1213 |
aurelien |
285 |
|
1267 |
jpm |
286 |
;
|
1213 |
aurelien |
287 |
|
|
|
288 |
|
1267 |
jpm |
289 |
SET SQL_MODE=@OLD_SQL_MODE;
|
|
|
290 |
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
|
1270 |
jpm |
291 |
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|