1 |
-- |
-- |
2 |
|
-- Ajout de table: avis_consultation_tmp; |
3 |
|
-- |
4 |
|
|
5 |
|
|
6 |
|
CREATE TABLE avis_consultation_tmp ( |
7 |
|
avis character varying(2) NOT NULL, |
8 |
|
libelle character varying(30) NOT NULL, |
9 |
|
typeavis character(1) DEFAULT ''::bpchar NOT NULL, |
10 |
|
sitadel character(1) DEFAULT ''::bpchar NOT NULL, |
11 |
|
sitadel_motif character(1) DEFAULT ''::bpchar NOT NULL |
12 |
|
); |
13 |
|
|
14 |
|
|
15 |
|
-- |
16 |
|
-- Data for Name: avis_consultation_tmp; |
17 |
|
-- |
18 |
|
|
19 |
|
INSERT INTO avis_consultation_tmp VALUES ('D', 'Defavorable', 'D', '6', ' '); |
20 |
|
INSERT INTO avis_consultation_tmp VALUES ('F', 'Favorable', 'F', '4', ' '); |
21 |
|
INSERT INTO avis_consultation_tmp VALUES ('F1', 'Favorable avec Reserve', 'F', '4', ' '); |
22 |
|
INSERT INTO avis_consultation_tmp VALUES ('T', 'Tacite', 'F', '2', ' '); |
23 |
|
INSERT INTO avis_consultation_tmp VALUES ('A', 'Autre', ' ', '7', ' '); |
24 |
|
|
25 |
|
|
26 |
|
-- |
27 |
-- Ajout de la table 'service_categorie' |
-- Ajout de la table 'service_categorie' |
28 |
-- |
-- |
29 |
CREATE TABLE service_categorie ( |
CREATE TABLE service_categorie ( |
169 |
|
|
170 |
ALTER TABLE avis_consultation ADD COLUMN avis_consultation integer NOT NULL DEFAULT nextval('avis_consultation_seq'::regclass); |
ALTER TABLE avis_consultation ADD COLUMN avis_consultation integer NOT NULL DEFAULT nextval('avis_consultation_seq'::regclass); |
171 |
INSERT INTO avis_consultation(avis_old, libelle) SELECT avis, libelle |
INSERT INTO avis_consultation(avis_old, libelle) SELECT avis, libelle |
172 |
FROM avis; |
FROM avis_consultation_tmp; |
173 |
|
|
174 |
|
|
175 |
ALTER TABLE ONLY avis_decision |
ALTER TABLE ONLY avis_decision |
225 |
ALTER TABLE avis_decision DROP COLUMN avis_old; |
ALTER TABLE avis_decision DROP COLUMN avis_old; |
226 |
ALTER TABLE avis_consultation DROP COLUMN avis_old; |
ALTER TABLE avis_consultation DROP COLUMN avis_old; |
227 |
DROP TABLE avis; |
DROP TABLE avis; |
228 |
|
DROP TABLE avis_consultation_tmp; |
229 |
|
|
230 |
-- |
-- |
231 |
-- Ajout des droits sur l'objet consultation_encours |
-- Ajout des droits sur l'objet consultation_encours |
340 |
INSERT INTO om_parametre VALUES (nextval('om_parametre_seq'::regclass),'lien_externe', '',1); |
INSERT INTO om_parametre VALUES (nextval('om_parametre_seq'::regclass),'lien_externe', '',1); |
341 |
ALTER TABLE om_parametre ALTER COLUMN valeur TYPE character varying(150); |
ALTER TABLE om_parametre ALTER COLUMN valeur TYPE character varying(150); |
342 |
|
|
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'avis_code_barre', '2'); |
|
343 |
|
|
344 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'avis_code_barre', '2'); |
345 |
|
|
346 |
|
-- |
347 |
|
-- Ajout des tables arrondissement, quartier et lien_localisation_nature |
348 |
|
-- |
349 |
|
CREATE TABLE arrondissement ( |
350 |
|
arrondissement integer NOT NULL, |
351 |
|
libelle character varying(3) NOT NULL |
352 |
|
); |
353 |
|
|
354 |
|
ALTER TABLE ONLY arrondissement |
355 |
|
ADD CONSTRAINT arrondissement_pkey PRIMARY KEY (arrondissement); |
356 |
|
|
357 |
|
CREATE TABLE quartier ( |
358 |
|
quartier integer NOT NULL, |
359 |
|
arrondissement integer NOT NULL, |
360 |
|
code_impots character varying(3) NOT NULL, |
361 |
|
libelle character varying(40) NOT NULL |
362 |
|
); |
363 |
|
|
364 |
|
ALTER TABLE ONLY quartier |
365 |
|
ADD CONSTRAINT quartier_pkey PRIMARY KEY (quartier); |
366 |
|
ALTER TABLE ONLY quartier |
367 |
|
ADD CONSTRAINT quartier_arrondissement_fkey FOREIGN KEY (arrondissement) REFERENCES arrondissement(arrondissement); |
368 |
|
|
369 |
|
CREATE TABLE lien_localisation_nature ( |
370 |
|
lien_localisation_nature integer NOT NULL, |
371 |
|
nature character varying(2), |
372 |
|
arrondissement integer, |
373 |
|
quartier integer , |
374 |
|
section varchar(2), |
375 |
|
instructeur integer NOT NULL |
376 |
|
); |
377 |
|
|
378 |
|
ALTER TABLE ONLY lien_localisation_nature |
379 |
|
ADD CONSTRAINT lien_localisation_nature_pkey PRIMARY KEY (lien_localisation_nature); |
380 |
|
ALTER TABLE ONLY lien_localisation_nature |
381 |
|
ADD CONSTRAINT lien_localisation_nature_nature_fkey FOREIGN KEY (nature) REFERENCES nature(nature); |
382 |
|
ALTER TABLE ONLY lien_localisation_nature |
383 |
|
ADD CONSTRAINT lien_localisation_nature_arrondissement_fkey FOREIGN KEY (arrondissement) REFERENCES arrondissement(arrondissement); |
384 |
|
ALTER TABLE ONLY lien_localisation_nature |
385 |
|
ADD CONSTRAINT lien_localisation_nature_quartier_fkey FOREIGN KEY (quartier) REFERENCES quartier(quartier); |
386 |
|
ALTER TABLE ONLY lien_localisation_nature |
387 |
|
ADD CONSTRAINT lien_localisation_nature_instructeur_fkey FOREIGN KEY (instructeur) REFERENCES instructeur(instructeur); |
388 |
|
|
389 |
|
-- Ajout des droits pour le retour des services |
390 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'demande_avis_encours', '2'); |
391 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'consultation_retour_service', '2'); |
392 |
|
|
393 |
|
-- Suppression des colonnes inutiles dans la table om_utilisateur |
394 |
|
ALTER TABLE om_utilisateur DROP instructeur; |
395 |
|
|
396 |
|
ALTER TABLE om_utilisateur DROP telephone; |
397 |
|
|
398 |
|
-- Ajout des droits sur lien_service_om_utilisateur |
399 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'lien_service_om_utilisateur', '2'); |
400 |
|
-- Ajout des droits pour le retour des services |
401 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'demande_avis_passee', '2'); |
402 |
|
|
403 |
|
-- Ajout des droits sur lien_localisation_nature |
404 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'lien_localisation_nature', '2'); |
405 |
|
|
406 |
|
-- Ajout du droit pour changer l'état (lu/non lu) d'une consultation |
407 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'consultation_modifier_lu', '2'); |
408 |
|
|
409 |
|
-- Changement de taille du champs parcelle de la table parcelle et terrain |
410 |
|
ALTER TABLE parcelle ALTER COLUMN parcelle TYPE character varying(20); |
411 |
|
ALTER TABLE terrain ALTER COLUMN parcelle TYPE character varying(20); |
412 |
|
|
413 |
|
|
414 |
|
-- |
415 |
|
-- Messages |
416 |
|
-- |
417 |
|
|
418 |
|
-- create sequence for the message ID generation |
419 |
|
CREATE SEQUENCE message_seq |
420 |
|
START WITH 1 |
421 |
|
INCREMENT BY 1 |
422 |
|
NO MINVALUE |
423 |
|
NO MAXVALUE |
424 |
|
CACHE 1; |
425 |
|
|
426 |
|
-- Create table messages |
427 |
|
CREATE TABLE message ( |
428 |
|
message integer PRIMARY KEY DEFAULT nextval('message_seq'), |
429 |
|
dossier character varying(12), |
430 |
|
type character varying(60), |
431 |
|
emetteur character varying(40), |
432 |
|
date_envoi DATE NOT NULL, |
433 |
|
enjeux_erp boolean default FALSE, |
434 |
|
enjeux_urba boolean default FALSE, |
435 |
|
lu boolean default FALSE |
436 |
|
); |
437 |
|
ALTER SEQUENCE message_seq OWNED BY message.message; |