1 |
|
-- |
2 |
|
-- START - #459 — Des lignes de données techniques vides sans aucune liaison remplissent ~10% de la table |
3 |
|
-- |
4 |
|
|
5 |
|
DELETE FROM donnees_techniques WHERE donnees_techniques = 17; |
6 |
|
UPDATE donnees_techniques SET dossier_autorisation = 'AT0130551300001' WHERE donnees_techniques = 18; |
7 |
|
|
8 |
|
|
9 |
|
-- Suppression de la contrainte pour pouvoir dupliquer la ligne de données techniques, et |
10 |
|
-- avoir temporairement 2 lignes liées au même DI. |
11 |
|
ALTER TABLE "donnees_techniques" |
12 |
|
DROP CONSTRAINT "donnees_techniques_dossier_instruction_unique"; |
13 |
|
|
14 |
|
-- Duplication des lignes de données techniques liées à un DA et un DI, en enlevant la |
15 |
|
-- liaison au DA. La ligne copiée est donc liée au DI. |
16 |
|
INSERT INTO donnees_techniques |
17 |
|
SELECT |
18 |
|
nextval('donnees_techniques_seq'), |
19 |
|
dossier_instruction, |
20 |
|
lot, |
21 |
|
am_lotiss, |
22 |
|
am_autre_div, |
23 |
|
am_camping, |
24 |
|
am_caravane, |
25 |
|
am_carav_duree, |
26 |
|
am_statio, |
27 |
|
am_statio_cont, |
28 |
|
am_affou_exhau, |
29 |
|
am_affou_exhau_sup, |
30 |
|
am_affou_prof, |
31 |
|
am_exhau_haut, |
32 |
|
am_coupe_abat, |
33 |
|
am_prot_plu, |
34 |
|
am_prot_muni, |
35 |
|
am_mobil_voyage, |
36 |
|
am_aire_voyage, |
37 |
|
am_rememb_afu, |
38 |
|
am_parc_resid_loi, |
39 |
|
am_sport_moto, |
40 |
|
am_sport_attrac, |
41 |
|
am_sport_golf, |
42 |
|
am_mob_art, |
43 |
|
am_modif_voie_esp, |
44 |
|
am_plant_voie_esp, |
45 |
|
am_chem_ouv_esp, |
46 |
|
am_agri_peche, |
47 |
|
am_crea_voie, |
48 |
|
am_modif_voie_exist, |
49 |
|
am_crea_esp_sauv, |
50 |
|
am_crea_esp_class, |
51 |
|
am_projet_desc, |
52 |
|
am_terr_surf, |
53 |
|
am_tranche_desc, |
54 |
|
am_lot_max_nb, |
55 |
|
am_lot_max_shon, |
56 |
|
am_lot_cstr_cos, |
57 |
|
am_lot_cstr_plan, |
58 |
|
am_lot_cstr_vente, |
59 |
|
am_lot_fin_diff, |
60 |
|
am_lot_consign, |
61 |
|
am_lot_gar_achev, |
62 |
|
am_lot_vente_ant, |
63 |
|
am_empl_nb, |
64 |
|
am_tente_nb, |
65 |
|
am_carav_nb, |
66 |
|
am_mobil_nb, |
67 |
|
am_pers_nb, |
68 |
|
am_empl_hll_nb, |
69 |
|
am_hll_shon, |
70 |
|
am_periode_exploit, |
71 |
|
am_exist_agrand, |
72 |
|
am_exist_date, |
73 |
|
am_exist_num, |
74 |
|
am_exist_nb_avant, |
75 |
|
am_exist_nb_apres, |
76 |
|
am_coupe_bois, |
77 |
|
am_coupe_parc, |
78 |
|
am_coupe_align, |
79 |
|
am_coupe_ess, |
80 |
|
am_coupe_age, |
81 |
|
am_coupe_dens, |
82 |
|
am_coupe_qual, |
83 |
|
am_coupe_trait, |
84 |
|
am_coupe_autr, |
85 |
|
co_archi_recours, |
86 |
|
co_cstr_nouv, |
87 |
|
co_cstr_exist, |
88 |
|
co_cloture, |
89 |
|
co_elec_tension, |
90 |
|
co_div_terr, |
91 |
|
co_projet_desc, |
92 |
|
co_anx_pisc, |
93 |
|
co_anx_gara, |
94 |
|
co_anx_veran, |
95 |
|
co_anx_abri, |
96 |
|
co_anx_autr, |
97 |
|
co_anx_autr_desc, |
98 |
|
co_tot_log_nb, |
99 |
|
co_tot_ind_nb, |
100 |
|
co_tot_coll_nb, |
101 |
|
co_mais_piece_nb, |
102 |
|
co_mais_niv_nb, |
103 |
|
co_fin_lls_nb, |
104 |
|
co_fin_aa_nb, |
105 |
|
co_fin_ptz_nb, |
106 |
|
co_fin_autr_nb, |
107 |
|
co_fin_autr_desc, |
108 |
|
co_mais_contrat_ind, |
109 |
|
co_uti_pers, |
110 |
|
co_uti_vente, |
111 |
|
co_uti_loc, |
112 |
|
co_uti_princ, |
113 |
|
co_uti_secon, |
114 |
|
co_resid_agees, |
115 |
|
co_resid_etud, |
116 |
|
co_resid_tourism, |
117 |
|
co_resid_hot_soc, |
118 |
|
co_resid_soc, |
119 |
|
co_resid_hand, |
120 |
|
co_resid_autr, |
121 |
|
co_resid_autr_desc, |
122 |
|
co_foyer_chamb_nb, |
123 |
|
co_log_1p_nb, |
124 |
|
co_log_2p_nb, |
125 |
|
co_log_3p_nb, |
126 |
|
co_log_4p_nb, |
127 |
|
co_log_5p_nb, |
128 |
|
co_log_6p_nb, |
129 |
|
co_bat_niv_nb, |
130 |
|
co_trx_exten, |
131 |
|
co_trx_surelev, |
132 |
|
co_trx_nivsup, |
133 |
|
co_demont_periode, |
134 |
|
co_sp_transport, |
135 |
|
co_sp_enseign, |
136 |
|
co_sp_act_soc, |
137 |
|
co_sp_ouvr_spe, |
138 |
|
co_sp_sante, |
139 |
|
co_sp_culture, |
140 |
|
co_statio_avt_nb, |
141 |
|
co_statio_apr_nb, |
142 |
|
co_statio_adr, |
143 |
|
co_statio_place_nb, |
144 |
|
co_statio_tot_surf, |
145 |
|
co_statio_tot_shob, |
146 |
|
co_statio_comm_cin_surf, |
147 |
|
su_avt_shon1, |
148 |
|
su_avt_shon2, |
149 |
|
su_avt_shon3, |
150 |
|
su_avt_shon4, |
151 |
|
su_avt_shon5, |
152 |
|
su_avt_shon6, |
153 |
|
su_avt_shon7, |
154 |
|
su_avt_shon8, |
155 |
|
su_avt_shon9, |
156 |
|
su_cstr_shon1, |
157 |
|
su_cstr_shon2, |
158 |
|
su_cstr_shon3, |
159 |
|
su_cstr_shon4, |
160 |
|
su_cstr_shon5, |
161 |
|
su_cstr_shon6, |
162 |
|
su_cstr_shon7, |
163 |
|
su_cstr_shon8, |
164 |
|
su_cstr_shon9, |
165 |
|
su_trsf_shon1, |
166 |
|
su_trsf_shon2, |
167 |
|
su_trsf_shon3, |
168 |
|
su_trsf_shon4, |
169 |
|
su_trsf_shon5, |
170 |
|
su_trsf_shon6, |
171 |
|
su_trsf_shon7, |
172 |
|
su_trsf_shon8, |
173 |
|
su_trsf_shon9, |
174 |
|
su_chge_shon1, |
175 |
|
su_chge_shon2, |
176 |
|
su_chge_shon3, |
177 |
|
su_chge_shon4, |
178 |
|
su_chge_shon5, |
179 |
|
su_chge_shon6, |
180 |
|
su_chge_shon7, |
181 |
|
su_chge_shon8, |
182 |
|
su_chge_shon9, |
183 |
|
su_demo_shon1, |
184 |
|
su_demo_shon2, |
185 |
|
su_demo_shon3, |
186 |
|
su_demo_shon4, |
187 |
|
su_demo_shon5, |
188 |
|
su_demo_shon6, |
189 |
|
su_demo_shon7, |
190 |
|
su_demo_shon8, |
191 |
|
su_demo_shon9, |
192 |
|
su_sup_shon1, |
193 |
|
su_sup_shon2, |
194 |
|
su_sup_shon3, |
195 |
|
su_sup_shon4, |
196 |
|
su_sup_shon5, |
197 |
|
su_sup_shon6, |
198 |
|
su_sup_shon7, |
199 |
|
su_sup_shon8, |
200 |
|
su_sup_shon9, |
201 |
|
su_tot_shon1, |
202 |
|
su_tot_shon2, |
203 |
|
su_tot_shon3, |
204 |
|
su_tot_shon4, |
205 |
|
su_tot_shon5, |
206 |
|
su_tot_shon6, |
207 |
|
su_tot_shon7, |
208 |
|
su_tot_shon8, |
209 |
|
su_tot_shon9, |
210 |
|
su_avt_shon_tot, |
211 |
|
su_cstr_shon_tot, |
212 |
|
su_trsf_shon_tot, |
213 |
|
su_chge_shon_tot, |
214 |
|
su_demo_shon_tot, |
215 |
|
su_sup_shon_tot, |
216 |
|
su_tot_shon_tot, |
217 |
|
dm_constr_dates, |
218 |
|
dm_total, |
219 |
|
dm_partiel, |
220 |
|
dm_projet_desc, |
221 |
|
dm_tot_log_nb, |
222 |
|
tax_surf_tot, |
223 |
|
tax_surf, |
224 |
|
tax_surf_suppr_mod, |
225 |
|
tax_su_princ_log_nb1, |
226 |
|
tax_su_princ_log_nb2, |
227 |
|
tax_su_princ_log_nb3, |
228 |
|
tax_su_princ_log_nb4, |
229 |
|
tax_su_princ_log_nb_tot1, |
230 |
|
tax_su_princ_log_nb_tot2, |
231 |
|
tax_su_princ_log_nb_tot3, |
232 |
|
tax_su_princ_log_nb_tot4, |
233 |
|
tax_su_princ_surf1, |
234 |
|
tax_su_princ_surf2, |
235 |
|
tax_su_princ_surf3, |
236 |
|
tax_su_princ_surf4, |
237 |
|
tax_su_princ_surf_sup1, |
238 |
|
tax_su_princ_surf_sup2, |
239 |
|
tax_su_princ_surf_sup3, |
240 |
|
tax_su_princ_surf_sup4, |
241 |
|
tax_su_heber_log_nb1, |
242 |
|
tax_su_heber_log_nb2, |
243 |
|
tax_su_heber_log_nb3, |
244 |
|
tax_su_heber_log_nb_tot1, |
245 |
|
tax_su_heber_log_nb_tot2, |
246 |
|
tax_su_heber_log_nb_tot3, |
247 |
|
tax_su_heber_surf1, |
248 |
|
tax_su_heber_surf2, |
249 |
|
tax_su_heber_surf3, |
250 |
|
tax_su_heber_surf_sup1, |
251 |
|
tax_su_heber_surf_sup2, |
252 |
|
tax_su_heber_surf_sup3, |
253 |
|
tax_su_secon_log_nb, |
254 |
|
tax_su_tot_log_nb, |
255 |
|
tax_su_secon_log_nb_tot, |
256 |
|
tax_su_tot_log_nb_tot, |
257 |
|
tax_su_secon_surf, |
258 |
|
tax_su_tot_surf, |
259 |
|
tax_su_secon_surf_sup, |
260 |
|
tax_su_tot_surf_sup, |
261 |
|
tax_ext_pret, |
262 |
|
tax_ext_desc, |
263 |
|
tax_surf_tax_exist_cons, |
264 |
|
tax_log_exist_nb, |
265 |
|
tax_am_statio_ext, |
266 |
|
tax_sup_bass_pisc, |
267 |
|
tax_empl_ten_carav_mobil_nb, |
268 |
|
tax_empl_hll_nb, |
269 |
|
tax_eol_haut_nb, |
270 |
|
tax_pann_volt_sup, |
271 |
|
tax_am_statio_ext_sup, |
272 |
|
tax_sup_bass_pisc_sup, |
273 |
|
tax_empl_ten_carav_mobil_nb_sup, |
274 |
|
tax_empl_hll_nb_sup, |
275 |
|
tax_eol_haut_nb_sup, |
276 |
|
tax_pann_volt_sup_sup, |
277 |
|
tax_trx_presc_ppr, |
278 |
|
tax_monu_hist, |
279 |
|
tax_comm_nb, |
280 |
|
tax_su_non_habit_surf1, |
281 |
|
tax_su_non_habit_surf2, |
282 |
|
tax_su_non_habit_surf3, |
283 |
|
tax_su_non_habit_surf4, |
284 |
|
tax_su_non_habit_surf5, |
285 |
|
tax_su_non_habit_surf6, |
286 |
|
tax_su_non_habit_surf7, |
287 |
|
tax_su_non_habit_surf_sup1, |
288 |
|
tax_su_non_habit_surf_sup2, |
289 |
|
tax_su_non_habit_surf_sup3, |
290 |
|
tax_su_non_habit_surf_sup4, |
291 |
|
tax_su_non_habit_surf_sup5, |
292 |
|
tax_su_non_habit_surf_sup6, |
293 |
|
tax_su_non_habit_surf_sup7, |
294 |
|
vsd_surf_planch_smd, |
295 |
|
vsd_unit_fonc_sup, |
296 |
|
vsd_unit_fonc_constr_sup, |
297 |
|
vsd_val_terr, |
298 |
|
vsd_const_sxist_non_dem_surf, |
299 |
|
vsd_rescr_fisc, |
300 |
|
pld_val_terr, |
301 |
|
pld_const_exist_dem, |
302 |
|
pld_const_exist_dem_surf, |
303 |
|
code_cnil, |
304 |
|
terr_juri_titul, |
305 |
|
terr_juri_lot, |
306 |
|
terr_juri_zac, |
307 |
|
terr_juri_afu, |
308 |
|
terr_juri_pup, |
309 |
|
terr_juri_oin, |
310 |
|
terr_juri_desc, |
311 |
|
terr_div_surf_etab, |
312 |
|
terr_div_surf_av_div, |
313 |
|
doc_date, |
314 |
|
doc_tot_trav, |
315 |
|
doc_tranche_trav, |
316 |
|
doc_tranche_trav_desc, |
317 |
|
doc_surf, |
318 |
|
doc_nb_log, |
319 |
|
doc_nb_log_indiv, |
320 |
|
doc_nb_log_coll, |
321 |
|
doc_nb_log_lls, |
322 |
|
doc_nb_log_aa, |
323 |
|
doc_nb_log_ptz, |
324 |
|
doc_nb_log_autre, |
325 |
|
daact_date, |
326 |
|
daact_date_chgmt_dest, |
327 |
|
daact_tot_trav, |
328 |
|
daact_tranche_trav, |
329 |
|
daact_tranche_trav_desc, |
330 |
|
daact_surf, |
331 |
|
daact_nb_log, |
332 |
|
daact_nb_log_indiv, |
333 |
|
daact_nb_log_coll, |
334 |
|
daact_nb_log_lls, |
335 |
|
daact_nb_log_aa, |
336 |
|
daact_nb_log_ptz, |
337 |
|
daact_nb_log_autre, |
338 |
|
NULL as dossier_autorisation, |
339 |
|
am_div_mun, |
340 |
|
co_perf_energ, |
341 |
|
architecte, |
342 |
|
co_statio_avt_shob, |
343 |
|
co_statio_apr_shob, |
344 |
|
co_statio_avt_surf, |
345 |
|
co_statio_apr_surf, |
346 |
|
co_trx_amgt, |
347 |
|
co_modif_aspect, |
348 |
|
co_modif_struct, |
349 |
|
co_ouvr_elec, |
350 |
|
co_ouvr_infra, |
351 |
|
co_trx_imm, |
352 |
|
co_cstr_shob, |
353 |
|
am_voyage_deb, |
354 |
|
am_voyage_fin, |
355 |
|
am_modif_amgt, |
356 |
|
am_lot_max_shob, |
357 |
|
mod_desc, |
358 |
|
tr_total, |
359 |
|
tr_partiel, |
360 |
|
tr_desc, |
361 |
|
avap_co_elt_pro, |
362 |
|
avap_nouv_haut_surf, |
363 |
|
avap_co_clot, |
364 |
|
avap_aut_coup_aba_arb, |
365 |
|
avap_ouv_infra, |
366 |
|
avap_aut_inst_mob, |
367 |
|
avap_aut_plant, |
368 |
|
avap_aut_auv_elec, |
369 |
|
tax_dest_loc_tr, |
370 |
|
ope_proj_desc, |
371 |
|
tax_surf_tot_cstr, |
372 |
|
cerfa, |
373 |
|
tax_surf_loc_stat, |
374 |
|
tax_su_princ_surf_stat1, |
375 |
|
tax_su_princ_surf_stat2, |
376 |
|
tax_su_princ_surf_stat3, |
377 |
|
tax_su_princ_surf_stat4, |
378 |
|
tax_su_secon_surf_stat, |
379 |
|
tax_su_heber_surf_stat1, |
380 |
|
tax_su_heber_surf_stat2, |
381 |
|
tax_su_heber_surf_stat3, |
382 |
|
tax_su_tot_surf_stat, |
383 |
|
tax_su_non_habit_surf_stat1, |
384 |
|
tax_su_non_habit_surf_stat2, |
385 |
|
tax_su_non_habit_surf_stat3, |
386 |
|
tax_su_non_habit_surf_stat4, |
387 |
|
tax_su_non_habit_surf_stat5, |
388 |
|
tax_su_non_habit_surf_stat6, |
389 |
|
tax_su_non_habit_surf_stat7, |
390 |
|
tax_su_parc_statio_expl_comm_surf, |
391 |
|
tax_log_ap_trvx_nb, |
392 |
|
tax_am_statio_ext_cr, |
393 |
|
tax_sup_bass_pisc_cr, |
394 |
|
tax_empl_ten_carav_mobil_nb_cr, |
395 |
|
tax_empl_hll_nb_cr, |
396 |
|
tax_eol_haut_nb_cr, |
397 |
|
tax_pann_volt_sup_cr, |
398 |
|
tax_surf_loc_arch, |
399 |
|
tax_surf_pisc_arch, |
400 |
|
tax_am_statio_ext_arch, |
401 |
|
tax_empl_ten_carav_mobil_nb_arch, |
402 |
|
tax_empl_hll_nb_arch, |
403 |
|
tax_eol_haut_nb_arch, |
404 |
|
ope_proj_div_co, |
405 |
|
ope_proj_div_contr, |
406 |
|
tax_desc, |
407 |
|
erp_cstr_neuve, |
408 |
|
erp_trvx_acc, |
409 |
|
erp_extension, |
410 |
|
erp_rehab, |
411 |
|
erp_trvx_am, |
412 |
|
erp_vol_nouv_exist, |
413 |
|
erp_loc_eff1, |
414 |
|
erp_loc_eff2, |
415 |
|
erp_loc_eff3, |
416 |
|
erp_loc_eff4, |
417 |
|
erp_loc_eff5, |
418 |
|
erp_loc_eff_tot, |
419 |
|
erp_public_eff1, |
420 |
|
erp_public_eff2, |
421 |
|
erp_public_eff3, |
422 |
|
erp_public_eff4, |
423 |
|
erp_public_eff5, |
424 |
|
erp_public_eff_tot, |
425 |
|
erp_perso_eff1, |
426 |
|
erp_perso_eff2, |
427 |
|
erp_perso_eff3, |
428 |
|
erp_perso_eff4, |
429 |
|
erp_perso_eff5, |
430 |
|
erp_perso_eff_tot, |
431 |
|
erp_tot_eff1, |
432 |
|
erp_tot_eff2, |
433 |
|
erp_tot_eff3, |
434 |
|
erp_tot_eff4, |
435 |
|
erp_tot_eff5, |
436 |
|
erp_tot_eff_tot, |
437 |
|
erp_class_cat, |
438 |
|
erp_class_type, |
439 |
|
tax_surf_abr_jard_pig_colom, |
440 |
|
tax_su_non_habit_abr_jard_pig_colom |
441 |
|
FROM donnees_techniques |
442 |
|
WHERE dossier_instruction NOTNULL AND dossier_autorisation NOTNULL; |
443 |
|
|
444 |
|
-- On supprime la liaison au DI pour la ligne initiale, toujours liée au DA et au DI |
445 |
|
UPDATE donnees_techniques SET dossier_instruction = NULL WHERE dossier_instruction NOTNULL AND dossier_autorisation NOTNULL; |
446 |
|
|
447 |
|
-- Suppression des lignes vides |
448 |
|
DELETE FROM donnees_techniques WHERE dossier_instruction IS NULL AND dossier_autorisation IS NULL; |
449 |
|
|
450 |
|
-- Ré-application de la contrainte |
451 |
|
ALTER TABLE "donnees_techniques" |
452 |
|
ADD CONSTRAINT "donnees_techniques_dossier_instruction_unique" UNIQUE ("dossier_instruction"); |
453 |
|
|
454 |
|
-- |
455 |
|
-- END - #459 — Des lignes de données techniques vides sans aucune liaison remplissent ~10% de la table |
456 |
|
-- |
457 |
|
|
458 |
|
-- |
459 |
|
-- START - #42 — Modification du fonctionnement de la synchro des contraintes |
460 |
|
-- |
461 |
|
|
462 |
|
INSERT INTO om_utilisateur VALUES ( |
463 |
|
nextval('om_utilisateur_seq'), |
464 |
|
'Administrateur gen Marseile', |
465 |
|
'[email protected]', |
466 |
|
'admingenmars', |
467 |
|
md5('admingenmars'), |
468 |
|
1, |
469 |
|
'DB', |
470 |
|
16 |
471 |
|
); |
472 |
|
|
473 |
|
-- |
474 |
|
-- END - #42 — Modification du fonctionnement de la synchro des contraintes |
475 |
|
-- |