/[openfoncier]/trunk/data/pgsql/v3.2.0-dev.sql
ViewVC logotype

Diff of /trunk/data/pgsql/v3.2.0-dev.sql

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 497 by vpihour, Fri Oct 12 15:35:11 2012 UTC revision 555 by vpihour, Tue Oct 30 14:05:14 2012 UTC
# Line 38  ALTER TABLE consultation ADD COLUMN serv Line 38  ALTER TABLE consultation ADD COLUMN serv
38  UPDATE consultation SET service=(select service.service from service where service_old=service.service_old);  UPDATE consultation SET service=(select service.service from service where service_old=service.service_old);
39    
40  ALTER TABLE service ADD COLUMN consultation_papier boolean;  ALTER TABLE service ADD COLUMN consultation_papier boolean;
41  ALTER TABLE service ADD COLUMN choix_consultation boolean;  ALTER TABLE service ADD COLUMN notification_email boolean;
42  ALTER TABLE service ADD COLUMN om_validite_debut date;  ALTER TABLE service ADD COLUMN om_validite_debut date;
43  ALTER TABLE service ADD COLUMN om_validite_fin date;  ALTER TABLE service ADD COLUMN om_validite_fin date;
44    ALTER TABLE service ADD COLUMN type_consultation varchar(70) NOT NULL DEFAULT 'avec_avis_attendu';
45    
46  ALTER TABLE service RENAME COLUMN service_old TO abrege;  ALTER TABLE service RENAME COLUMN service_old TO abrege;
47  ALTER TABLE consultation DROP COLUMN service_old;  ALTER TABLE consultation DROP COLUMN service_old;
# Line 178  ALTER TABLE consultation ADD COLUMN fich Line 179  ALTER TABLE consultation ADD COLUMN fich
179  ALTER TABLE consultation ADD COLUMN lu boolean;  ALTER TABLE consultation ADD COLUMN lu boolean;
180    
181    
182    
183  UPDATE evenement SET avis_decision=(select avis_decision.avis_decision from avis_decision where avis=avis_decision.avis_old);  UPDATE evenement SET avis_decision=(select avis_decision.avis_decision from avis_decision where avis=avis_decision.avis_old);
184  UPDATE instruction SET avis_decision=(select avis_decision.avis_decision from avis_decision where avis=avis_decision.avis_old);  UPDATE instruction SET avis_decision=(select avis_decision.avis_decision from avis_decision where avis=avis_decision.avis_old);
185  UPDATE dossier SET avis_decision=(select avis_decision.avis_decision from avis_decision where avis=avis_decision.avis_old);  UPDATE dossier SET avis_decision=(select avis_decision.avis_decision from avis_decision where avis=avis_decision.avis_old);
# Line 200  ALTER TABLE avis_consultation DROP COLUM Line 202  ALTER TABLE avis_consultation DROP COLUM
202  DROP TABLE avis;  DROP TABLE avis;
203    
204  --  --
205    -- Ajout des droits sur l'objet consultation_encours
206    --
207    
208    
209    INSERT INTO om_widget VALUES (1, 1, 'Retours de consultations', '../scr/tab.php?obj=consultation_mes_retours', '<script type=''text/javascript''>
210        $.ajax({
211            type: ''GET'',
212           url:''../app/get_num_consult.php'',
213           cache: false,
214            success: function(html){
215                $(''#number_return'').append(html);
216            }
217        });
218    </script>
219    <div id="number_return"></div>',2);
220    
221    --
222  -- Ajout des droits sur les nouvelles tables  -- Ajout des droits sur les nouvelles tables
223  --  --
224  INSERT INTO om_droit VALUES ('75','service_categorie', '4');  INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'service_categorie', '4');
225  INSERT INTO om_droit VALUES ('76','avis_decision', '4');  INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'avis_decision', '4');
226  INSERT INTO om_droit VALUES ('77','avis_consultation', '4');  INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'avis_consultation', '4');
227  INSERT INTO om_droit VALUES ('78','lien_service_service_categorie', '4');  INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'lien_service_service_categorie', '4');
228    
229    ALTER TABLE consultation ALTER service SET NOT NULL;
230    ALTER TABLE dossier ADD COLUMN enjeu boolean;
231    INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'consultation_mes_retours', 4);
232    INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'consultation_tous_retours', 4);
233    
234    --
235    -- Modification de la structure des instructeurs
236    --
237    CREATE SEQUENCE direction_seq
238        START WITH 1
239        INCREMENT BY 1
240        NO MINVALUE
241        NO MAXVALUE
242        CACHE 1;
243        
244    CREATE TABLE direction (
245      direction integer NOT NULL,
246      code character varying(20) NOT NULL,
247      libelle character varying(40) NOT NULL,
248      description text,
249      chef character varying(30) NOT NULL,
250      PRIMARY KEY (direction)
251    );
252    
253    INSERT INTO direction VALUES (nextval('direction_seq'::regclass),'ADS', 'Direction ADS', 'Direction des autorisations des droits du sol', 'Mme Dupont');
254    
255    CREATE SEQUENCE division_seq
256        START WITH 1
257        INCREMENT BY 1
258        NO MINVALUE
259        NO MAXVALUE
260        CACHE 1;
261        
262    CREATE TABLE division (
263      division integer NOT NULL,
264      code character varying(20) NOT NULL,
265      libelle character varying(40) NOT NULL,
266      description text,
267      chef character varying(30) NOT NULL,
268      direction integer NOT NULL,
269      PRIMARY KEY (division),
270      FOREIGN KEY ( direction ) REFERENCES direction ( direction )
271    );
272    
273    INSERT INTO division VALUES (nextval('division_seq'::regclass),'Defaut', 'Division par defaut', '', 'Mme Dupont',1);
274    
275    CREATE SEQUENCE instructeur_seq
276        START WITH 1
277        INCREMENT BY 1
278        NO MINVALUE
279        NO MAXVALUE
280        CACHE 1;
281        
282    CREATE TABLE instructeur (
283      instructeur integer NOT NULL,
284      nom character varying(30) NOT NULL,
285      telephone character varying(14),
286      division integer NOT NULL,
287      om_utilisateur integer,
288      PRIMARY KEY ( instructeur ),
289      FOREIGN KEY ( division ) REFERENCES division ( division ),
290      FOREIGN KEY ( om_utilisateur ) REFERENCES om_utilisateur ( om_utilisateur )
291    );
292    
293    -- Insertion des utilisateurs instructeurs dans la table instructeur
294    INSERT INTO instructeur (instructeur,nom,telephone,division,om_utilisateur)
295    (SELECT om_utilisateur,nom,telephone,1,om_utilisateur FROM om_utilisateur WHERE instructeur='Oui');
296    -- Mise a jour de la sequence
297    SELECT setval('instructeur_seq',(SELECT MAX(instructeur) FROM instructeur));
298    
299    -- Creation du parametre pour afficher ou non la division dans les dossiers
300    INSERT INTO om_parametre VALUES (nextval('om_parametre_seq'::regclass),'afficher_division','false',1);
301    
302    -- Ajout des droits sur les tables d'organisation
303    INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'direction', '2');
304    INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'division', '2');
305    INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'instructeur', '2');
306    
307    -- Modification de la clé étrangère  dossier -> om_utilisateur par dossier -> instructeur
308    ALTER TABLE dossier DROP CONSTRAINT dossier_instructeur_fkey;
309    ALTER TABLE dossier ADD CONSTRAINT
310    dossier_instructeur_fkey FOREIGN KEY (instructeur) REFERENCES instructeur(instructeur);
311    
312    -- Ajout des parametres des liens dans la table om_parametre
313    INSERT INTO om_parametre VALUES (nextval('om_parametre_seq'::regclass),'lien_interne_vdm', '',1);
314    INSERT INTO om_parametre VALUES (nextval('om_parametre_seq'::regclass),'lien_externe', '',1);
315    ALTER TABLE om_parametre ALTER COLUMN valeur TYPE character varying(150);
316    
317    
318    INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'avis_code_barre', '2');
319    
320    --
321    -- Ajout des tables arrondissement, quartier et lien_localisation_nature
322    --
323    CREATE TABLE arrondissement (
324            arrondissement integer NOT NULL,
325            numero character varying(3) NOT NULL
326    );
327    
328    ALTER TABLE ONLY arrondissement
329        ADD CONSTRAINT arrondissement_pkey PRIMARY KEY (arrondissement);
330    
331    CREATE TABLE quartier (
332            quartier integer NOT NULL,
333            code_impots character varying(3) NOT NULL,
334            libelle character varying(40) NOT NULL
335    );
336    
337    ALTER TABLE ONLY quartier
338        ADD CONSTRAINT quartier_pkey PRIMARY KEY (quartier);
339    
340    CREATE TABLE lien_localisation_nature (
341            lien_localisation_nature integer NOT NULL,
342            nature character varying(2) NOT NULL,
343            arrondissement integer NOT NULL,
344            quartier integer NOT NULL,
345            section varchar(10)  NOT NULL default '*'
346    );
347    
348    ALTER TABLE ONLY lien_localisation_nature
349        ADD CONSTRAINT lien_localisation_nature_pkey PRIMARY KEY (lien_localisation_nature);
350    ALTER TABLE ONLY lien_localisation_nature
351        ADD CONSTRAINT lien_localisation_nature_nature_fkey FOREIGN KEY (nature) REFERENCES nature(nature);
352    ALTER TABLE ONLY lien_localisation_nature
353        ADD CONSTRAINT lien_localisation_nature_arrondissement_fkey FOREIGN KEY (arrondissement) REFERENCES arrondissement(arrondissement);
354    ALTER TABLE ONLY lien_localisation_nature
355        ADD CONSTRAINT lien_localisation_nature_quartier_fkey FOREIGN KEY (quartier) REFERENCES quartier(quartier);
356    
357    INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'avis_code_barre', '2');
358    
359    -- Ajout des droits pour le retour des services
360    INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'demande_encours', '2');
361    INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'consultation_retour_service', '2');
362    
363    -- Suppression des colonnes inutiles dans la table om_utilisateur
364    ALTER TABLE om_utilisateur DROP instructeur;
365    
366    ALTER TABLE om_utilisateur DROP telephone;
367    
368    -- Ajout des droits sur lien_service_om_utilisateur
369    INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'lien_service_om_utilisateur', '2');
370    -- Ajout des droits pour le retour des services
371    INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'demande_passee', '2');

Legend:
Removed from v.497  
changed lines
  Added in v.555

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26