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 |
270 |
CREATE TABLE direction ( |
CREATE TABLE direction ( |
271 |
direction integer NOT NULL, |
direction integer NOT NULL, |
272 |
code character varying(20) NOT NULL, |
code character varying(20) NOT NULL, |
273 |
libelle character varying(40) NOT NULL, |
libelle character varying(100) NOT NULL, |
274 |
description text, |
description text, |
275 |
chef character varying(30) NOT NULL, |
chef character varying(100) NOT NULL, |
276 |
|
om_validite_debut date, |
277 |
|
om_validite_fin date, |
278 |
PRIMARY KEY (direction) |
PRIMARY KEY (direction) |
279 |
); |
); |
280 |
|
|
281 |
INSERT INTO direction VALUES (nextval('direction_seq'::regclass),'ADS', 'Direction ADS', 'Direction des autorisations des droits du sol', 'Mme Dupont'); |
INSERT INTO direction VALUES (nextval('direction_seq'::regclass),'ADS', 'Direction ADS', 'Direction des autorisations des droits du sol', 'Mme Dupont', NULL, NULL); |
282 |
|
|
283 |
CREATE SEQUENCE division_seq |
CREATE SEQUENCE division_seq |
284 |
START WITH 1 |
START WITH 1 |
290 |
CREATE TABLE division ( |
CREATE TABLE division ( |
291 |
division integer NOT NULL, |
division integer NOT NULL, |
292 |
code character varying(20) NOT NULL, |
code character varying(20) NOT NULL, |
293 |
libelle character varying(40) NOT NULL, |
libelle character varying(100) NOT NULL, |
294 |
description text, |
description text, |
295 |
chef character varying(30) NOT NULL, |
chef character varying(100) NOT NULL, |
296 |
direction integer NOT NULL, |
direction integer NOT NULL, |
297 |
|
om_validite_debut date, |
298 |
|
om_validite_fin date, |
299 |
PRIMARY KEY (division), |
PRIMARY KEY (division), |
300 |
FOREIGN KEY ( direction ) REFERENCES direction ( direction ) |
FOREIGN KEY ( direction ) REFERENCES direction ( direction ) |
301 |
); |
); |
302 |
|
|
303 |
INSERT INTO division VALUES (nextval('division_seq'::regclass),'Defaut', 'Division par defaut', '', 'Mme Dupont',1); |
INSERT INTO division VALUES (nextval('division_seq'::regclass),'Defaut', 'Division par defaut', '', 'Mme Dupont',1, NULL, NULL); |
304 |
|
|
305 |
CREATE SEQUENCE instructeur_seq |
CREATE SEQUENCE instructeur_seq |
306 |
START WITH 1 |
START WITH 1 |
311 |
|
|
312 |
CREATE TABLE instructeur ( |
CREATE TABLE instructeur ( |
313 |
instructeur integer NOT NULL, |
instructeur integer NOT NULL, |
314 |
nom character varying(30) NOT NULL, |
nom character varying(100) NOT NULL, |
315 |
telephone character varying(14), |
telephone character varying(14), |
316 |
division integer NOT NULL, |
division integer NOT NULL, |
317 |
om_utilisateur integer, |
om_utilisateur integer, |
318 |
|
om_validite_debut date, |
319 |
|
om_validite_fin date, |
320 |
PRIMARY KEY ( instructeur ), |
PRIMARY KEY ( instructeur ), |
321 |
FOREIGN KEY ( division ) REFERENCES division ( division ), |
FOREIGN KEY ( division ) REFERENCES division ( division ), |
322 |
FOREIGN KEY ( om_utilisateur ) REFERENCES om_utilisateur ( om_utilisateur ) |
FOREIGN KEY ( om_utilisateur ) REFERENCES om_utilisateur ( om_utilisateur ) |
354 |
-- |
-- |
355 |
CREATE TABLE arrondissement ( |
CREATE TABLE arrondissement ( |
356 |
arrondissement integer NOT NULL, |
arrondissement integer NOT NULL, |
357 |
numero character varying(3) NOT NULL |
libelle character varying(3) NOT NULL |
358 |
); |
); |
359 |
|
|
360 |
ALTER TABLE ONLY arrondissement |
ALTER TABLE ONLY arrondissement |
362 |
|
|
363 |
CREATE TABLE quartier ( |
CREATE TABLE quartier ( |
364 |
quartier integer NOT NULL, |
quartier integer NOT NULL, |
365 |
|
arrondissement integer NOT NULL, |
366 |
code_impots character varying(3) NOT NULL, |
code_impots character varying(3) NOT NULL, |
367 |
libelle character varying(40) NOT NULL |
libelle character varying(40) NOT NULL |
368 |
); |
); |
369 |
|
|
370 |
ALTER TABLE ONLY quartier |
ALTER TABLE ONLY quartier |
371 |
ADD CONSTRAINT quartier_pkey PRIMARY KEY (quartier); |
ADD CONSTRAINT quartier_pkey PRIMARY KEY (quartier); |
372 |
|
ALTER TABLE ONLY quartier |
373 |
|
ADD CONSTRAINT quartier_arrondissement_fkey FOREIGN KEY (arrondissement) REFERENCES arrondissement(arrondissement); |
374 |
|
|
375 |
CREATE TABLE lien_localisation_nature ( |
CREATE TABLE lien_localisation_nature ( |
376 |
lien_localisation_nature integer NOT NULL, |
lien_localisation_nature integer NOT NULL, |
377 |
nature character varying(2) NOT NULL, |
nature character varying(2), |
378 |
arrondissement integer NOT NULL, |
arrondissement integer, |
379 |
quartier integer NOT NULL, |
quartier integer , |
380 |
section varchar(10) NOT NULL default '*' |
section varchar(2), |
381 |
|
instructeur integer NOT NULL |
382 |
); |
); |
383 |
|
|
384 |
ALTER TABLE ONLY lien_localisation_nature |
ALTER TABLE ONLY lien_localisation_nature |
389 |
ADD CONSTRAINT lien_localisation_nature_arrondissement_fkey FOREIGN KEY (arrondissement) REFERENCES arrondissement(arrondissement); |
ADD CONSTRAINT lien_localisation_nature_arrondissement_fkey FOREIGN KEY (arrondissement) REFERENCES arrondissement(arrondissement); |
390 |
ALTER TABLE ONLY lien_localisation_nature |
ALTER TABLE ONLY lien_localisation_nature |
391 |
ADD CONSTRAINT lien_localisation_nature_quartier_fkey FOREIGN KEY (quartier) REFERENCES quartier(quartier); |
ADD CONSTRAINT lien_localisation_nature_quartier_fkey FOREIGN KEY (quartier) REFERENCES quartier(quartier); |
392 |
|
ALTER TABLE ONLY lien_localisation_nature |
393 |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'avis_code_barre', '2'); |
ADD CONSTRAINT lien_localisation_nature_instructeur_fkey FOREIGN KEY (instructeur) REFERENCES instructeur(instructeur); |
394 |
|
|
395 |
-- Ajout des droits pour le retour des services |
-- Ajout des droits pour le retour des services |
396 |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'demande_encours', '2'); |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'demande_avis_encours', '2'); |
397 |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'consultation_retour_service', '2'); |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'consultation_retour_service', '2'); |
398 |
|
|
399 |
-- Suppression des colonnes inutiles dans la table om_utilisateur |
-- Suppression des colonnes inutiles dans la table om_utilisateur |
404 |
-- Ajout des droits sur lien_service_om_utilisateur |
-- Ajout des droits sur lien_service_om_utilisateur |
405 |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'lien_service_om_utilisateur', '2'); |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'lien_service_om_utilisateur', '2'); |
406 |
-- Ajout des droits pour le retour des services |
-- Ajout des droits pour le retour des services |
407 |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'demande_passee', '2'); |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'demande_avis_passee', '2'); |
408 |
|
|
409 |
|
-- Ajout des droits sur lien_localisation_nature |
410 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'lien_localisation_nature', '2'); |
411 |
|
|
412 |
|
-- Ajout du droit pour changer l'état (lu/non lu) d'une consultation |
413 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'consultation_modifier_lu', '2'); |
414 |
|
|
415 |
|
-- Changement de taille du champs parcelle de la table parcelle et terrain |
416 |
|
ALTER TABLE parcelle ALTER COLUMN parcelle TYPE character varying(20); |
417 |
|
ALTER TABLE terrain ALTER COLUMN parcelle TYPE character varying(20); |
418 |
|
|
419 |
|
|
420 |
|
-- |
421 |
|
-- Messages |
422 |
|
-- |
423 |
|
|
424 |
|
-- create sequence for the message ID generation |
425 |
|
CREATE SEQUENCE messages_seq |
426 |
|
START WITH 1 |
427 |
|
INCREMENT BY 1 |
428 |
|
NO MINVALUE |
429 |
|
NO MAXVALUE |
430 |
|
CACHE 1; |
431 |
|
|
432 |
|
-- Create table messages |
433 |
|
CREATE TABLE messages ( |
434 |
|
message integer PRIMARY KEY DEFAULT nextval('messages_seq'), |
435 |
|
dossier character varying(12), |
436 |
|
type character varying(60), |
437 |
|
emetteur character varying(40), |
438 |
|
date_emission DATE NOT NULL, |
439 |
|
enjeux_erp boolean default FALSE, |
440 |
|
enjeux_urba boolean default FALSE, |
441 |
|
lu boolean default FALSE, |
442 |
|
FOREIGN KEY ( dossier ) REFERENCES dossier ( dossier ) -- add this |
443 |
|
); |
444 |
|
ALTER SEQUENCE messages_seq OWNED BY messages.message; |
445 |
|
|
446 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'menu_suivi', '2'); |
447 |
|
|
448 |
|
-- Droit de l'ajout forcé d'un instructeur |
449 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'dossier_modifier_instructeur', '2'); |