1--
2-- Name: relations; Type: SCHEMA; Schema: -; Owner: -
3--
4
5CREATE SCHEMA relations;
6
7--
8-- Name: c_amgmt_amgmt_lot; Type: TABLE; Schema: relations; Owner: -
9--
10
11CREATE TABLE relations.c_amgmt_amgmt_lot (
12    id integer NOT NULL,
13    id_amgmt character varying(80),
14    id_amgmt_lot character varying(80)
15);
16
17
18--
19-- Name: c_amgmt_amgmt_lot_id_seq; Type: SEQUENCE; Schema: relations; Owner: -
20--
21
22CREATE SEQUENCE relations.c_amgmt_amgmt_lot_id_seq
23    START WITH 1
24    INCREMENT BY 1
25    NO MINVALUE
26    NO MAXVALUE
27    CACHE 1;
28
29
30--
31-- Name: c_amgmt_amgmt_lot_id_seq; Type: SEQUENCE OWNED BY; Schema: relations; Owner: -
32--
33
34ALTER SEQUENCE relations.c_amgmt_amgmt_lot_id_seq OWNED BY relations.c_amgmt_amgmt_lot.id;
35
36
37--
38-- Name: c_batiment_bat_lot; Type: TABLE; Schema: relations; Owner: -
39--
40
41CREATE TABLE relations.c_batiment_bat_lot (
42    id integer NOT NULL,
43    id_bat character varying(80),
44    id_bat_lot character varying(80)
45);
46
47
48--
49-- Name: c_batiment_bat_lot_id_seq; Type: SEQUENCE; Schema: relations; Owner: -
50--
51
52CREATE SEQUENCE relations.c_batiment_bat_lot_id_seq
53    START WITH 1
54    INCREMENT BY 1
55    NO MINVALUE
56    NO MAXVALUE
57    CACHE 1;
58
59
60--
61-- Name: c_batiment_bat_lot_id_seq; Type: SEQUENCE OWNED BY; Schema: relations; Owner: -
62--
63
64ALTER SEQUENCE relations.c_batiment_bat_lot_id_seq OWNED BY relations.c_batiment_bat_lot.id;
65
66
67--
68-- Name: c_ens_immo_amgmt; Type: TABLE; Schema: relations; Owner: -
69--
70
71CREATE TABLE relations.c_ens_immo_amgmt (
72    id integer NOT NULL,
73    id_ens_immo character varying(80),
74    id_amgmt character varying(80)
75);
76
77
78--
79-- Name: c_ens_immo_amgmt_id_seq; Type: SEQUENCE; Schema: relations; Owner: -
80--
81
82CREATE SEQUENCE relations.c_ens_immo_amgmt_id_seq
83    START WITH 1
84    INCREMENT BY 1
85    NO MINVALUE
86    NO MAXVALUE
87    CACHE 1;
88
89
90--
91-- Name: c_ens_immo_amgmt_id_seq; Type: SEQUENCE OWNED BY; Schema: relations; Owner: -
92--
93
94ALTER SEQUENCE relations.c_ens_immo_amgmt_id_seq OWNED BY relations.c_ens_immo_amgmt.id;
95
96
97--
98-- Name: c_ens_immo_bat; Type: TABLE; Schema: relations; Owner: -
99--
100
101CREATE TABLE relations.c_ens_immo_bat (
102    id integer NOT NULL,
103    id_ens_immo character varying(80),
104    id_bat character varying(80)
105);
106
107
108--
109-- Name: c_ens_immo_bat_id_seq; Type: SEQUENCE; Schema: relations; Owner: -
110--
111
112CREATE SEQUENCE relations.c_ens_immo_bat_id_seq
113    START WITH 1
114    INCREMENT BY 1
115    NO MINVALUE
116    NO MAXVALUE
117    CACHE 1;
118
119
120--
121-- Name: c_ens_immo_bat_id_seq; Type: SEQUENCE OWNED BY; Schema: relations; Owner: -
122--
123
124ALTER SEQUENCE relations.c_ens_immo_bat_id_seq OWNED BY relations.c_ens_immo_bat.id;
125
126
127--
128-- Name: c_terrain_ens_immo; Type: TABLE; Schema: relations; Owner: -
129--
130
131CREATE TABLE relations.c_terrain_ens_immo (
132    id integer NOT NULL,
133    id_terrain character varying(80),
134    id_ens_immo character varying(80)
135);
136
137
138--
139-- Name: c_terrain_ens_immo_id_seq; Type: SEQUENCE; Schema: relations; Owner: -
140--
141
142CREATE SEQUENCE relations.c_terrain_ens_immo_id_seq
143    START WITH 1
144    INCREMENT BY 1
145    NO MINVALUE
146    NO MAXVALUE
147    CACHE 1;
148
149
150--
151-- Name: c_terrain_ens_immo_id_seq; Type: SEQUENCE OWNED BY; Schema: relations; Owner: -
152--
153
154ALTER SEQUENCE relations.c_terrain_ens_immo_id_seq OWNED BY relations.c_terrain_ens_immo.id;
155
156
157--
158-- Name: t_actes; Type: TABLE; Schema: relations; Owner: -
159--
160
161CREATE TABLE relations.t_actes (
162    cnumero character varying(20) NOT NULL,
163    nature text,
164    numero_avenant text,
165    description text,
166    text_de_deliberation text,
167    text_signature text,
168    en_attente text,
169    amodiataire text,
170    tiers_ac_amodiataire text,
171    exploitant text,
172    tiers_ac_exploitant text,
173    bien text,
174    text_bien text,
175    bien_en_option text,
176    text_bien_option text,
177    periodicite_facture text,
178    base_ text,
179    duree_annees text,
180    duree_mois text,
181    duree_jours text,
182    text_d_effet text,
183    text_fin_periode_ini text,
184    preavis_fin_initiale text,
185    nbre_de_renouvelle text,
186    duree_renouvellement text,
187    unite_renouvellement text,
188    preavis_en_mois_reno text,
189    redevance_variable text,
190    abattement_multiple text,
191    echeance_30_jours_fd text,
192    n_d_immeuble text,
193    regime_de_tva_ text,
194    text_origine text,
195    operation_origine text,
196    explication_origine text,
197    acte_origine_ text,
198    text_destination text,
199    operation_destinatio text,
200    explication_destinat text,
201    acte_destination text,
202    nombre_facturations text,
203    nombre_sous_locataire text,
204    presence_agenda text,
205    presence_particulari text,
206    numero_derniere_fact text,
207    text_derniere_factur text,
208    type_derniere_factur text,
209    utilisateur text,
210    text_acte text,
211    heure_acte text,
212    repertoires_des_anne text,
213    faculte_resiliation text,
214    nbannee_resiliation text,
215    nbmois_resiliation text,
216    nbjour_resiliation text,
217    text_faculte_resiliation text,
218    text_exercice_resiliation text,
219    renouvellement text,
220    rrr_redevance text,
221    rrr_traffic text,
222    remarque_renouvellement text,
223    text_fin_contrat_avec_renouv text,
224    id_udc text,
225    id_activite text,
226    observation text,
227    tacite_reconduction text
228);
229
230
231--
232-- Name: t_adresse; Type: TABLE; Schema: relations; Owner: -
233--
234
235CREATE TABLE relations.t_adresse (
236    id bigint NOT NULL,
237    id_adresse character varying(80),
238    numero_rue character varying(80),
239    rue character varying(80),
240    code_postal character varying(80),
241    commune character varying(80),
242    code_insee_commune character varying(80),
243    code_fantoir character varying(80)
244);
245
246
247--
248-- Name: t_adresse_id_seq; Type: SEQUENCE; Schema: relations; Owner: -
249--
250
251CREATE SEQUENCE relations.t_adresse_id_seq
252    START WITH 1
253    INCREMENT BY 1
254    NO MINVALUE
255    NO MAXVALUE
256    CACHE 1;
257
258
259--
260-- Name: t_adresse_id_seq; Type: SEQUENCE OWNED BY; Schema: relations; Owner: -
261--
262
263ALTER SEQUENCE relations.t_adresse_id_seq OWNED BY relations.t_adresse.id;
264
265
266--
267-- Name: t_amgmt; Type: TABLE; Schema: relations; Owner: -
268--
269
270CREATE TABLE relations.t_amgmt (
271    id integer NOT NULL,
272    id_amgmt character varying(80),
273    fk_adresse character varying(80),
274    description character varying(80)
275);
276
277
278--
279-- Name: t_amgmt_id_seq; Type: SEQUENCE; Schema: relations; Owner: -
280--
281
282CREATE SEQUENCE relations.t_amgmt_id_seq
283    START WITH 1
284    INCREMENT BY 1
285    NO MINVALUE
286    NO MAXVALUE
287    CACHE 1;
288
289
290--
291-- Name: t_amgmt_id_seq; Type: SEQUENCE OWNED BY; Schema: relations; Owner: -
292--
293
294ALTER SEQUENCE relations.t_amgmt_id_seq OWNED BY relations.t_amgmt.id;
295
296
297--
298-- Name: t_amgmt_lot; Type: TABLE; Schema: relations; Owner: -
299--
300
301CREATE TABLE relations.t_amgmt_lot (
302    id integer NOT NULL,
303    geom public.geometry(MultiPolygon,3948),
304    id_amgmt_lot character varying(80),
305    fk_adresse character varying(80),
306    numero character varying(80),
307    type character varying(80),
308    etat character varying(80),
309    description character varying(80),
310    fk_acte character varying(80),
311    fk_invariant character varying(80)
312);
313
314
315--
316-- Name: t_amgmt_lot_xy_id_seq; Type: SEQUENCE; Schema: relations; Owner: -
317--
318
319CREATE SEQUENCE relations.t_amgmt_lot_xy_id_seq
320    START WITH 1
321    INCREMENT BY 1
322    NO MINVALUE
323    NO MAXVALUE
324    CACHE 1;
325
326
327--
328-- Name: t_amgmt_lot_xy_id_seq; Type: SEQUENCE OWNED BY; Schema: relations; Owner: -
329--
330
331ALTER SEQUENCE relations.t_amgmt_lot_xy_id_seq OWNED BY relations.t_amgmt_lot.id;
332
333
334--
335-- Name: t_bat; Type: TABLE; Schema: relations; Owner: -
336--
337
338CREATE TABLE relations.t_bat (
339    id integer NOT NULL,
340    geom public.geometry(MultiPolygon,3948),
341    id_bat character varying(80),
342    fk_adresse character varying(80),
343    descriptio character varying(80),
344    apercu text,
345    repertoire text,
346    date_couverture date,
347    date_ravalement date
348);
349
350
351--
352-- Name: t_bat_id_seq; Type: SEQUENCE; Schema: relations; Owner: -
353--
354
355CREATE SEQUENCE relations.t_bat_id_seq
356    START WITH 1
357    INCREMENT BY 1
358    NO MINVALUE
359    NO MAXVALUE
360    CACHE 1;
361
362
363--
364-- Name: t_bat_id_seq; Type: SEQUENCE OWNED BY; Schema: relations; Owner: -
365--
366
367ALTER SEQUENCE relations.t_bat_id_seq OWNED BY relations.t_bat.id;
368
369
370--
371-- Name: t_bat_lot; Type: TABLE; Schema: relations; Owner: -
372--
373
374CREATE TABLE relations.t_bat_lot (
375    id integer NOT NULL,
376    id_bat_lot character varying(80),
377    fk_adresse character varying(80),
378    num_lot character varying(80),
379    type character varying(80),
380    etat character varying(80),
381    description character varying(80),
382    fk_acte character varying(80),
383    repertoire text,
384    fk_invariant character varying(80)
385);
386
387
388--
389-- Name: t_bat_lot_id_seq; Type: SEQUENCE; Schema: relations; Owner: -
390--
391
392CREATE SEQUENCE relations.t_bat_lot_id_seq
393    START WITH 1
394    INCREMENT BY 1
395    NO MINVALUE
396    NO MAXVALUE
397    CACHE 1;
398
399
400--
401-- Name: t_bat_lot_id_seq; Type: SEQUENCE OWNED BY; Schema: relations; Owner: -
402--
403
404ALTER SEQUENCE relations.t_bat_lot_id_seq OWNED BY relations.t_bat_lot.id;
405
406
407--
408-- Name: t_ens_immo; Type: TABLE; Schema: relations; Owner: -
409--
410
411CREATE TABLE relations.t_ens_immo (
412    id integer NOT NULL,
413    id_ens_immo character varying(80),
414    fk_adresse character varying(80),
415    description character varying(80)
416);
417
418
419--
420-- Name: t_ens_immo_id_seq; Type: SEQUENCE; Schema: relations; Owner: -
421--
422
423CREATE SEQUENCE relations.t_ens_immo_id_seq
424    START WITH 1
425    INCREMENT BY 1
426    NO MINVALUE
427    NO MAXVALUE
428    CACHE 1;
429
430
431--
432-- Name: t_ens_immo_id_seq; Type: SEQUENCE OWNED BY; Schema: relations; Owner: -
433--
434
435ALTER SEQUENCE relations.t_ens_immo_id_seq OWNED BY relations.t_ens_immo.id;
436
437
438--
439-- Name: t_terrain; Type: TABLE; Schema: relations; Owner: -
440--
441
442CREATE TABLE relations.t_terrain (
443    id integer NOT NULL,
444    geom public.geometry(MultiPolygon,3948),
445    id_terrain character varying(80),
446    fk_adresse character varying(80),
447    fk_acte character varying(80),
448    nature character varying(80),
449    fk_invariant character varying(80)
450);
451
452
453--
454-- Name: t_terrain_xy_id_seq; Type: SEQUENCE; Schema: relations; Owner: -
455--
456
457CREATE SEQUENCE relations.t_terrain_xy_id_seq
458    START WITH 1
459    INCREMENT BY 1
460    NO MINVALUE
461    NO MAXVALUE
462    CACHE 1;
463
464
465--
466-- Name: t_terrain_xy_id_seq; Type: SEQUENCE OWNED BY; Schema: relations; Owner: -
467--
468
469ALTER SEQUENCE relations.t_terrain_xy_id_seq OWNED BY relations.t_terrain.id;
470
471
472--
473-- Name: c_amgmt_amgmt_lot id; Type: DEFAULT; Schema: relations; Owner: -
474--
475
476ALTER TABLE ONLY relations.c_amgmt_amgmt_lot ALTER COLUMN id SET DEFAULT nextval('relations.c_amgmt_amgmt_lot_id_seq'::regclass);
477
478
479--
480-- Name: c_batiment_bat_lot id; Type: DEFAULT; Schema: relations; Owner: -
481--
482
483ALTER TABLE ONLY relations.c_batiment_bat_lot ALTER COLUMN id SET DEFAULT nextval('relations.c_batiment_bat_lot_id_seq'::regclass);
484
485
486--
487-- Name: c_ens_immo_amgmt id; Type: DEFAULT; Schema: relations; Owner: -
488--
489
490ALTER TABLE ONLY relations.c_ens_immo_amgmt ALTER COLUMN id SET DEFAULT nextval('relations.c_ens_immo_amgmt_id_seq'::regclass);
491
492
493--
494-- Name: c_ens_immo_bat id; Type: DEFAULT; Schema: relations; Owner: -
495--
496
497ALTER TABLE ONLY relations.c_ens_immo_bat ALTER COLUMN id SET DEFAULT nextval('relations.c_ens_immo_bat_id_seq'::regclass);
498
499
500--
501-- Name: c_terrain_ens_immo id; Type: DEFAULT; Schema: relations; Owner: -
502--
503
504ALTER TABLE ONLY relations.c_terrain_ens_immo ALTER COLUMN id SET DEFAULT nextval('relations.c_terrain_ens_immo_id_seq'::regclass);
505
506
507--
508-- Name: t_adresse id; Type: DEFAULT; Schema: relations; Owner: -
509--
510
511ALTER TABLE ONLY relations.t_adresse ALTER COLUMN id SET DEFAULT nextval('relations.t_adresse_id_seq'::regclass);
512
513
514--
515-- Name: t_amgmt id; Type: DEFAULT; Schema: relations; Owner: -
516--
517
518ALTER TABLE ONLY relations.t_amgmt ALTER COLUMN id SET DEFAULT nextval('relations.t_amgmt_id_seq'::regclass);
519
520
521--
522-- Name: t_amgmt_lot id; Type: DEFAULT; Schema: relations; Owner: -
523--
524
525ALTER TABLE ONLY relations.t_amgmt_lot ALTER COLUMN id SET DEFAULT nextval('relations.t_amgmt_lot_xy_id_seq'::regclass);
526
527
528--
529-- Name: t_bat id; Type: DEFAULT; Schema: relations; Owner: -
530--
531
532ALTER TABLE ONLY relations.t_bat ALTER COLUMN id SET DEFAULT nextval('relations.t_bat_id_seq'::regclass);
533
534
535--
536-- Name: t_bat_lot id; Type: DEFAULT; Schema: relations; Owner: -
537--
538
539ALTER TABLE ONLY relations.t_bat_lot ALTER COLUMN id SET DEFAULT nextval('relations.t_bat_lot_id_seq'::regclass);
540
541
542--
543-- Name: t_ens_immo id; Type: DEFAULT; Schema: relations; Owner: -
544--
545
546ALTER TABLE ONLY relations.t_ens_immo ALTER COLUMN id SET DEFAULT nextval('relations.t_ens_immo_id_seq'::regclass);
547
548
549--
550-- Name: t_terrain id; Type: DEFAULT; Schema: relations; Owner: -
551--
552
553ALTER TABLE ONLY relations.t_terrain ALTER COLUMN id SET DEFAULT nextval('relations.t_terrain_xy_id_seq'::regclass);
554
555
556--
557-- Name: t_amgmt ID_AMGMT; Type: CONSTRAINT; Schema: relations; Owner: -
558--
559
560ALTER TABLE ONLY relations.t_amgmt
561    ADD CONSTRAINT "ID_AMGMT" PRIMARY KEY (id);
562
563
564--
565-- Name: c_amgmt_amgmt_lot c_amgmt_amgmt_lot_pkey; Type: CONSTRAINT; Schema: relations; Owner: -
566--
567
568ALTER TABLE ONLY relations.c_amgmt_amgmt_lot
569    ADD CONSTRAINT c_amgmt_amgmt_lot_pkey PRIMARY KEY (id);
570
571
572--
573-- Name: c_batiment_bat_lot c_batiment_bat_lot_pkey; Type: CONSTRAINT; Schema: relations; Owner: -
574--
575
576ALTER TABLE ONLY relations.c_batiment_bat_lot
577    ADD CONSTRAINT c_batiment_bat_lot_pkey PRIMARY KEY (id);
578
579
580--
581-- Name: c_ens_immo_amgmt c_ens_immo_amgmt_pkey; Type: CONSTRAINT; Schema: relations; Owner: -
582--
583
584ALTER TABLE ONLY relations.c_ens_immo_amgmt
585    ADD CONSTRAINT c_ens_immo_amgmt_pkey PRIMARY KEY (id);
586
587
588--
589-- Name: c_ens_immo_bat c_ens_immo_bat_pkey; Type: CONSTRAINT; Schema: relations; Owner: -
590--
591
592ALTER TABLE ONLY relations.c_ens_immo_bat
593    ADD CONSTRAINT c_ens_immo_bat_pkey PRIMARY KEY (id);
594
595
596--
597-- Name: t_actes id_numero; Type: CONSTRAINT; Schema: relations; Owner: -
598--
599
600ALTER TABLE ONLY relations.t_actes
601    ADD CONSTRAINT id_numero PRIMARY KEY (cnumero);
602
603
604--
605-- Name: t_adresse t_adresse_pkey; Type: CONSTRAINT; Schema: relations; Owner: -
606--
607
608ALTER TABLE ONLY relations.t_adresse
609    ADD CONSTRAINT t_adresse_pkey PRIMARY KEY (id);
610
611
612--
613-- Name: t_bat t_bat_pkey; Type: CONSTRAINT; Schema: relations; Owner: -
614--
615
616ALTER TABLE ONLY relations.t_bat
617    ADD CONSTRAINT t_bat_pkey PRIMARY KEY (id);
618
619
620--
621-- Name: t_ens_immo t_ens_immo_pkey; Type: CONSTRAINT; Schema: relations; Owner: -
622--
623
624ALTER TABLE ONLY relations.t_ens_immo
625    ADD CONSTRAINT t_ens_immo_pkey PRIMARY KEY (id);
626
627
628--
629-- Name: c_ens_immo_amgmt_id_amgmt_key; Type: INDEX; Schema: relations; Owner: -
630--
631
632CREATE UNIQUE INDEX c_ens_immo_amgmt_id_amgmt_key ON relations.c_ens_immo_amgmt USING btree (id_amgmt);
633
634
635--
636-- Name: c_ens_immo_bat_id_bat_key; Type: INDEX; Schema: relations; Owner: -
637--
638
639CREATE UNIQUE INDEX c_ens_immo_bat_id_bat_key ON relations.c_ens_immo_bat USING btree (id_bat);
640
641
642--
643-- Name: sidx_t_bat_geom; Type: INDEX; Schema: relations; Owner: -
644--
645
646CREATE INDEX sidx_t_bat_geom ON relations.t_bat USING gist (geom);
647
648
649--
650-- Name: t_adresse_id_adresse_key; Type: INDEX; Schema: relations; Owner: -
651--
652
653CREATE UNIQUE INDEX t_adresse_id_adresse_key ON relations.t_adresse USING btree (id_adresse);
654
655
656--
657-- Name: t_amgmt_id_amgmt_key; Type: INDEX; Schema: relations; Owner: -
658--
659
660CREATE UNIQUE INDEX t_amgmt_id_amgmt_key ON relations.t_amgmt USING btree (id_amgmt);
661
662
663--
664-- Name: t_amgmt_lot_id_amgmt_lot_key; Type: INDEX; Schema: relations; Owner: -
665--
666
667CREATE UNIQUE INDEX t_amgmt_lot_id_amgmt_lot_key ON relations.t_amgmt_lot USING btree (id_amgmt_lot);
668
669
670--
671-- Name: t_bat_id_bat_key; Type: INDEX; Schema: relations; Owner: -
672--
673
674CREATE UNIQUE INDEX t_bat_id_bat_key ON relations.t_bat USING btree (id_bat);
675
676
677--
678-- Name: t_bat_lot_id_bat_lot_key; Type: INDEX; Schema: relations; Owner: -
679--
680
681CREATE UNIQUE INDEX t_bat_lot_id_bat_lot_key ON relations.t_bat_lot USING btree (id_bat_lot);
682
683
684--
685-- Name: t_ens_immo_id_ens_immo_key; Type: INDEX; Schema: relations; Owner: -
686--
687
688CREATE UNIQUE INDEX t_ens_immo_id_ens_immo_key ON relations.t_ens_immo USING btree (id_ens_immo);
689
690
691--
692-- Name: t_terrain_id_terrain_key; Type: INDEX; Schema: relations; Owner: -
693--
694
695CREATE UNIQUE INDEX t_terrain_id_terrain_key ON relations.t_terrain USING btree (id_terrain);
696
697
698--
699-- Name: c_amgmt_amgmt_lot c_amgmt_amgmt_lot_fk; Type: FK CONSTRAINT; Schema: relations; Owner: -
700--
701
702ALTER TABLE ONLY relations.c_amgmt_amgmt_lot
703    ADD CONSTRAINT c_amgmt_amgmt_lot_fk FOREIGN KEY (id_amgmt) REFERENCES relations.t_amgmt(id_amgmt);
704
705
706--
707-- Name: c_amgmt_amgmt_lot c_amgmt_amgmt_lot_fk_amgt_lot; Type: FK CONSTRAINT; Schema: relations; Owner: -
708--
709
710ALTER TABLE ONLY relations.c_amgmt_amgmt_lot
711    ADD CONSTRAINT c_amgmt_amgmt_lot_fk_amgt_lot FOREIGN KEY (id_amgmt_lot) REFERENCES relations.t_amgmt_lot(id_amgmt_lot);
712
713
714--
715-- Name: c_batiment_bat_lot c_batiment_bat_lot_fk_bat_lot; Type: FK CONSTRAINT; Schema: relations; Owner: -
716--
717
718ALTER TABLE ONLY relations.c_batiment_bat_lot
719    ADD CONSTRAINT c_batiment_bat_lot_fk_bat_lot FOREIGN KEY (id_bat_lot) REFERENCES relations.t_bat_lot(id_bat_lot);
720
721
722--
723-- Name: c_batiment_bat_lot c_batiment_bat_lot_fk_t_bat; Type: FK CONSTRAINT; Schema: relations; Owner: -
724--
725
726ALTER TABLE ONLY relations.c_batiment_bat_lot
727    ADD CONSTRAINT c_batiment_bat_lot_fk_t_bat FOREIGN KEY (id_bat) REFERENCES relations.t_bat(id_bat);
728
729
730--
731-- Name: c_ens_immo_amgmt c_ens_immo_amgmt_fk_amgmt; Type: FK CONSTRAINT; Schema: relations; Owner: -
732--
733
734ALTER TABLE ONLY relations.c_ens_immo_amgmt
735    ADD CONSTRAINT c_ens_immo_amgmt_fk_amgmt FOREIGN KEY (id_amgmt) REFERENCES relations.t_amgmt(id_amgmt);
736
737
738--
739-- Name: c_ens_immo_amgmt c_ens_immo_amgmt_fk_ens_immo; Type: FK CONSTRAINT; Schema: relations; Owner: -
740--
741
742ALTER TABLE ONLY relations.c_ens_immo_amgmt
743    ADD CONSTRAINT c_ens_immo_amgmt_fk_ens_immo FOREIGN KEY (id_ens_immo) REFERENCES relations.t_ens_immo(id_ens_immo);
744
745
746--
747-- Name: c_ens_immo_bat c_ens_immo_bat_fk; Type: FK CONSTRAINT; Schema: relations; Owner: -
748--
749
750ALTER TABLE ONLY relations.c_ens_immo_bat
751    ADD CONSTRAINT c_ens_immo_bat_fk FOREIGN KEY (id_ens_immo) REFERENCES relations.t_ens_immo(id_ens_immo);
752
753
754--
755-- Name: c_terrain_ens_immo c_terrain_ens_immo_fk_id_ens_immo; Type: FK CONSTRAINT; Schema: relations; Owner: -
756--
757
758ALTER TABLE ONLY relations.c_terrain_ens_immo
759    ADD CONSTRAINT c_terrain_ens_immo_fk_id_ens_immo FOREIGN KEY (id_ens_immo) REFERENCES relations.t_ens_immo(id_ens_immo);
760
761
762--
763-- Name: c_terrain_ens_immo c_terrain_ens_immo_fk_id_terrain; Type: FK CONSTRAINT; Schema: relations; Owner: -
764--
765
766ALTER TABLE ONLY relations.c_terrain_ens_immo
767    ADD CONSTRAINT c_terrain_ens_immo_fk_id_terrain FOREIGN KEY (id_terrain) REFERENCES relations.t_terrain(id_terrain);
768
769
770--
771-- Name: t_amgmt_lot t_amgmt_lot_fk; Type: FK CONSTRAINT; Schema: relations; Owner: -
772--
773
774ALTER TABLE ONLY relations.t_amgmt_lot
775    ADD CONSTRAINT t_amgmt_lot_fk FOREIGN KEY (fk_adresse) REFERENCES relations.t_adresse(id_adresse);
776
777
778--
779-- Name: t_amgmt_lot t_amgmt_lot_fk1; Type: FK CONSTRAINT; Schema: relations; Owner: -
780--
781
782ALTER TABLE ONLY relations.t_amgmt_lot
783    ADD CONSTRAINT t_amgmt_lot_fk1 FOREIGN KEY (fk_acte) REFERENCES relations.t_actes(cnumero) MATCH FULL;
784
785
786--
787-- Name: t_bat t_bat_fk; Type: FK CONSTRAINT; Schema: relations; Owner: -
788--
789
790ALTER TABLE ONLY relations.t_bat
791    ADD CONSTRAINT t_bat_fk FOREIGN KEY (id_bat) REFERENCES relations.c_ens_immo_bat(id_bat);
792
793
794--
795-- Name: t_bat t_bat_fk_adresse; Type: FK CONSTRAINT; Schema: relations; Owner: -
796--
797
798ALTER TABLE ONLY relations.t_bat
799    ADD CONSTRAINT t_bat_fk_adresse FOREIGN KEY (fk_adresse) REFERENCES relations.t_adresse(id_adresse);
800
801
802--
803-- Name: t_bat_lot t_bat_lot_fk; Type: FK CONSTRAINT; Schema: relations; Owner: -
804--
805
806ALTER TABLE ONLY relations.t_bat_lot
807    ADD CONSTRAINT t_bat_lot_fk FOREIGN KEY (fk_adresse) REFERENCES relations.t_adresse(id_adresse);
808
809
810--
811-- Name: t_bat_lot t_bat_lot_fk_acte; Type: FK CONSTRAINT; Schema: relations; Owner: -
812--
813
814ALTER TABLE ONLY relations.t_bat_lot
815    ADD CONSTRAINT t_bat_lot_fk_acte FOREIGN KEY (fk_acte) REFERENCES relations.t_actes(cnumero);
816
817
818--
819-- Name: t_ens_immo t_ens_immo_fk; Type: FK CONSTRAINT; Schema: relations; Owner: -
820--
821
822ALTER TABLE ONLY relations.t_ens_immo
823    ADD CONSTRAINT t_ens_immo_fk FOREIGN KEY (fk_adresse) REFERENCES relations.t_adresse(id_adresse);
824
825
826--
827-- Name: t_terrain t_terrain_fk; Type: FK CONSTRAINT; Schema: relations; Owner: -
828--
829
830ALTER TABLE ONLY relations.t_terrain
831    ADD CONSTRAINT t_terrain_fk FOREIGN KEY (fk_adresse) REFERENCES relations.t_adresse(id_adresse);
832
833
834--
835-- Name: t_terrain t_terrain_fk1; Type: FK CONSTRAINT; Schema: relations; Owner: -
836--
837
838ALTER TABLE ONLY relations.t_terrain
839    ADD CONSTRAINT t_terrain_fk1 FOREIGN KEY (fk_acte) REFERENCES relations.t_actes(cnumero);
840
841
842
843--
844-- Spaced schema and table
845--
846
847ALTER TABLE IF EXISTS ONLY "spaced schema"."spaced child" DROP CONSTRAINT IF EXISTS parent_fk;
848ALTER TABLE IF EXISTS ONLY "spaced schema"."spaced parent" DROP CONSTRAINT IF EXISTS "spaced parent_pkey";
849ALTER TABLE IF EXISTS ONLY "spaced schema"."spaced child" DROP CONSTRAINT IF EXISTS "spaced child_pkey";
850ALTER TABLE IF EXISTS "spaced schema"."spaced parent" ALTER COLUMN id DROP DEFAULT;
851ALTER TABLE IF EXISTS "spaced schema"."spaced child" ALTER COLUMN id DROP DEFAULT;
852DROP SEQUENCE IF EXISTS "spaced schema"."spaced parent_id_seq";
853DROP TABLE IF EXISTS "spaced schema"."spaced parent";
854DROP SEQUENCE IF EXISTS "spaced schema"."spaced child_id_seq";
855DROP TABLE IF EXISTS "spaced schema"."spaced child";
856DROP SCHEMA IF EXISTS "spaced schema";
857--
858-- Name: spaced schema; Type: SCHEMA; Schema: -; Owner: -
859--
860
861CREATE SCHEMA "spaced schema";
862
863
864SET default_tablespace = '';
865
866SET default_with_oids = false;
867
868--
869-- Name: spaced child; Type: TABLE; Schema: spaced schema; Owner: -
870--
871
872CREATE TABLE "spaced schema"."spaced child" (
873    id integer NOT NULL,
874    name character varying,
875    parent_id integer
876);
877
878
879--
880-- Name: spaced child_id_seq; Type: SEQUENCE; Schema: spaced schema; Owner: -
881--
882
883CREATE SEQUENCE "spaced schema"."spaced child_id_seq"
884    AS integer
885    START WITH 1
886    INCREMENT BY 1
887    NO MINVALUE
888    NO MAXVALUE
889    CACHE 1;
890
891
892--
893-- Name: spaced child_id_seq; Type: SEQUENCE OWNED BY; Schema: spaced schema; Owner: -
894--
895
896ALTER SEQUENCE "spaced schema"."spaced child_id_seq" OWNED BY "spaced schema"."spaced child".id;
897
898
899--
900-- Name: spaced parent; Type: TABLE; Schema: spaced schema; Owner: -
901--
902
903CREATE TABLE "spaced schema"."spaced parent" (
904    id integer NOT NULL,
905    name character varying
906);
907
908
909--
910-- Name: spaced parent_id_seq; Type: SEQUENCE; Schema: spaced schema; Owner: -
911--
912
913CREATE SEQUENCE "spaced schema"."spaced parent_id_seq"
914    AS integer
915    START WITH 1
916    INCREMENT BY 1
917    NO MINVALUE
918    NO MAXVALUE
919    CACHE 1;
920
921
922--
923-- Name: spaced parent_id_seq; Type: SEQUENCE OWNED BY; Schema: spaced schema; Owner: -
924--
925
926ALTER SEQUENCE "spaced schema"."spaced parent_id_seq" OWNED BY "spaced schema"."spaced parent".id;
927
928
929--
930-- Name: spaced child id; Type: DEFAULT; Schema: spaced schema; Owner: -
931--
932
933ALTER TABLE ONLY "spaced schema"."spaced child" ALTER COLUMN id SET DEFAULT nextval('"spaced schema"."spaced child_id_seq"'::regclass);
934
935
936--
937-- Name: spaced parent id; Type: DEFAULT; Schema: spaced schema; Owner: -
938--
939
940ALTER TABLE ONLY "spaced schema"."spaced parent" ALTER COLUMN id SET DEFAULT nextval('"spaced schema"."spaced parent_id_seq"'::regclass);
941
942
943--
944-- Name: spaced child spaced child_pkey; Type: CONSTRAINT; Schema: spaced schema; Owner: -
945--
946
947ALTER TABLE ONLY "spaced schema"."spaced child"
948    ADD CONSTRAINT "spaced child_pkey" PRIMARY KEY (id);
949
950
951--
952-- Name: spaced parent spaced parent_pkey; Type: CONSTRAINT; Schema: spaced schema; Owner: -
953--
954
955ALTER TABLE ONLY "spaced schema"."spaced parent"
956    ADD CONSTRAINT "spaced parent_pkey" PRIMARY KEY (id);
957
958
959--
960-- Name: spaced child parent_fk; Type: FK CONSTRAINT; Schema: spaced schema; Owner: -
961--
962
963ALTER TABLE ONLY "spaced schema"."spaced child"
964    ADD CONSTRAINT parent_fk FOREIGN KEY (parent_id) REFERENCES "spaced schema"."spaced parent"(id);
965
966