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 |
392 |
ALTER TABLE ONLY lien_localisation_nature |
ALTER TABLE ONLY lien_localisation_nature |
393 |
ADD CONSTRAINT lien_localisation_nature_instructeur_fkey FOREIGN KEY (instructeur) REFERENCES instructeur(instructeur); |
ADD CONSTRAINT lien_localisation_nature_instructeur_fkey FOREIGN KEY (instructeur) REFERENCES instructeur(instructeur); |
394 |
|
|
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'avis_code_barre', '2'); |
|
|
|
|
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_avis_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'); |
411 |
|
|
412 |
-- Ajout du droit pour changer l'état (lu/non lu) d'une consultation |
-- 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'); |
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'); |