-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgeopublic-20160115-all.sql
1261 lines (911 loc) · 31.8 KB
/
geopublic-20160115-all.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--
-- PostgreSQL database dump
--
-- Dumped from database version 9.3.10
-- Dumped by pg_dump version 9.3.10
-- Started on 2016-01-15 18:55:49 WET
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
--
-- TOC entry 6 (class 2615 OID 45736)
-- Name: ppgis; Type: SCHEMA; Schema: -; Owner: geobox
--
CREATE SCHEMA ppgis;
ALTER SCHEMA ppgis OWNER TO geobox;
SET search_path = ppgis, pg_catalog;
--
-- TOC entry 1421 (class 1255 OID 235121)
-- Name: createdefaultlayer(); Type: FUNCTION; Schema: ppgis; Owner: geobox
--
CREATE FUNCTION createdefaultlayer() RETURNS trigger
LANGUAGE plpgsql
AS $_$
DECLARE
estado integer;
BEGIN
INSERT INTO public.tema (ord, titulo, url, tipo, srid, activo, visivel, idutilizador, idplano)
VALUES (10, 'OSM', 'http://a.tile.openstreetmap.org/${z}/${x}/${y}.png,http://b.tile.openstreetmap.org/${z}/${x}/${y}.png,http://c.tile.openstreetmap.org/${z}/${x}/${y}.png',
'OSM', 3857, TRUE, TRUE, NEW.idutilizador, NEW.id);
INSERT INTO ppgis.estado (id, idplano, estado, significado, color, icon)
VALUES (1, NEW.id, 'Submitted', 'Participation submitted', 'red', 'resources/images/traffic-cone-icon-red-32.png');
RETURN NEW;
END;
$_$;
ALTER FUNCTION ppgis.createdefaultlayer() OWNER TO geobox;
--
-- TOC entry 1417 (class 1255 OID 45737)
-- Name: updateparticipationstate(); Type: FUNCTION; Schema: ppgis; Owner: geobox
--
CREATE FUNCTION updateparticipationstate() RETURNS trigger
LANGUAGE plpgsql
AS $$
DECLARE
estado integer;
BEGIN
SELECT idestado INTO STRICT estado FROM ppgis.ocorrencia WHERE ppgis.ocorrencia.id = new.idocorrencia;
IF NEW.idestado IS NULL THEN
NEW.idestado = estado;
ELSE
IF NEW.idestado != estado THEN
UPDATE ppgis.ocorrencia
SET idestado = new.idestado,
datamodificacao = now()
WHERE ppgis.ocorrencia.id = new.idocorrencia;
END IF;
END IF;
RETURN NEW;
END;
$$;
ALTER FUNCTION ppgis.updateparticipationstate() OWNER TO geobox;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- TOC entry 186 (class 1259 OID 45738)
-- Name: comentario; Type: TABLE; Schema: ppgis; Owner: geobox; Tablespace:
--
CREATE TABLE comentario (
id integer NOT NULL,
comentario text,
datacriacao timestamp with time zone DEFAULT now(),
datamodificacao timestamp with time zone DEFAULT now(),
idocorrencia integer,
idutilizador integer NOT NULL,
idestado integer NOT NULL,
apagado boolean DEFAULT false NOT NULL
);
ALTER TABLE ppgis.comentario OWNER TO geobox;
--
-- TOC entry 187 (class 1259 OID 45743)
-- Name: comentario_id_seq; Type: SEQUENCE; Schema: ppgis; Owner: geobox
--
CREATE SEQUENCE comentario_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE ppgis.comentario_id_seq OWNER TO geobox;
--
-- TOC entry 3814 (class 0 OID 0)
-- Dependencies: 187
-- Name: comentario_id_seq; Type: SEQUENCE OWNED BY; Schema: ppgis; Owner: geobox
--
ALTER SEQUENCE comentario_id_seq OWNED BY comentario.id;
--
-- TOC entry 188 (class 1259 OID 45745)
-- Name: estado; Type: TABLE; Schema: ppgis; Owner: geobox; Tablespace:
--
CREATE TABLE estado (
id integer NOT NULL,
idplano integer NOT NULL,
estado character varying(30),
significado character varying(200),
color character varying(24),
icon character varying(250)
);
ALTER TABLE ppgis.estado OWNER TO geobox;
--
-- TOC entry 189 (class 1259 OID 45751)
-- Name: fotografia; Type: TABLE; Schema: ppgis; Owner: geobox; Tablespace:
--
CREATE TABLE fotografia (
id integer NOT NULL,
idocorrencia integer NOT NULL,
pasta character varying(255),
caminho character varying(255) NOT NULL,
observacoes text,
idutilizador integer NOT NULL,
tamanho integer,
largura integer,
altura integer,
inapropriada boolean DEFAULT false NOT NULL,
datacriacao timestamp with time zone DEFAULT now(),
datamodificacao timestamp with time zone DEFAULT now(),
apagado boolean DEFAULT false NOT NULL,
name character varying(255)
);
ALTER TABLE ppgis.fotografia OWNER TO geobox;
--
-- TOC entry 190 (class 1259 OID 45760)
-- Name: fotografia_id_seq; Type: SEQUENCE; Schema: ppgis; Owner: geobox
--
CREATE SEQUENCE fotografia_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE ppgis.fotografia_id_seq OWNER TO geobox;
--
-- TOC entry 3815 (class 0 OID 0)
-- Dependencies: 190
-- Name: fotografia_id_seq; Type: SEQUENCE OWNED BY; Schema: ppgis; Owner: geobox
--
ALTER SEQUENCE fotografia_id_seq OWNED BY fotografia.id;
--
-- TOC entry 191 (class 1259 OID 45762)
-- Name: fotografiatmp; Type: TABLE; Schema: ppgis; Owner: geobox; Tablespace:
--
CREATE TABLE fotografiatmp (
id integer NOT NULL,
sessionid character varying(24),
pasta character varying(255),
caminho character varying(255) NOT NULL,
observacoes text,
idutilizador integer NOT NULL,
tamanho integer,
largura integer,
altura integer,
inapropriada boolean DEFAULT false NOT NULL,
datacriacao timestamp with time zone DEFAULT now(),
datamodificacao timestamp with time zone DEFAULT now(),
name character varying(255)
);
ALTER TABLE ppgis.fotografiatmp OWNER TO geobox;
--
-- TOC entry 192 (class 1259 OID 45771)
-- Name: fotografiatmp_id_seq; Type: SEQUENCE; Schema: ppgis; Owner: geobox
--
CREATE SEQUENCE fotografiatmp_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE ppgis.fotografiatmp_id_seq OWNER TO geobox;
--
-- TOC entry 3816 (class 0 OID 0)
-- Dependencies: 192
-- Name: fotografiatmp_id_seq; Type: SEQUENCE OWNED BY; Schema: ppgis; Owner: geobox
--
ALTER SEQUENCE fotografiatmp_id_seq OWNED BY fotografiatmp.id;
--
-- TOC entry 193 (class 1259 OID 45773)
-- Name: ocorrencia; Type: TABLE; Schema: ppgis; Owner: geobox; Tablespace:
--
CREATE TABLE ocorrencia (
id integer NOT NULL,
idplano integer NOT NULL,
idestado integer NOT NULL,
idtipoocorrencia integer,
titulo character varying(100),
participacao text,
the_geom public.geometry(Point,900913),
idutilizador integer NOT NULL,
apagado boolean DEFAULT false NOT NULL,
datacriacao timestamp with time zone DEFAULT now(),
datamodificacao timestamp with time zone DEFAULT now(),
proposta text,
CONSTRAINT enforce_dims_the_geom CHECK ((public.st_ndims(the_geom) = 2)),
CONSTRAINT enforce_geotype_the_geom CHECK (((public.geometrytype(the_geom) = 'POINT'::text) OR (the_geom IS NULL))),
CONSTRAINT enforce_srid_the_geom CHECK ((public.st_srid(the_geom) = 900913))
);
ALTER TABLE ppgis.ocorrencia OWNER TO geobox;
--
-- TOC entry 194 (class 1259 OID 45785)
-- Name: ocorrencia_id_seq; Type: SEQUENCE; Schema: ppgis; Owner: geobox
--
CREATE SEQUENCE ocorrencia_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE ppgis.ocorrencia_id_seq OWNER TO geobox;
--
-- TOC entry 3817 (class 0 OID 0)
-- Dependencies: 194
-- Name: ocorrencia_id_seq; Type: SEQUENCE OWNED BY; Schema: ppgis; Owner: geobox
--
ALTER SEQUENCE ocorrencia_id_seq OWNED BY ocorrencia.id;
--
-- TOC entry 195 (class 1259 OID 45787)
-- Name: plano; Type: TABLE; Schema: ppgis; Owner: geobox; Tablespace:
--
CREATE TABLE plano (
id integer NOT NULL,
idpromotor integer NOT NULL,
designacao character varying(100) NOT NULL,
descricao text,
responsavel character varying(100) NOT NULL,
email character varying(120) NOT NULL,
site character varying(120),
inicio timestamp with time zone DEFAULT now() NOT NULL,
fim timestamp with time zone DEFAULT (now() + '30 days'::interval) NOT NULL,
datamodificacao timestamp with time zone DEFAULT now() NOT NULL,
idutilizador integer NOT NULL,
the_geom public.geometry(Polygon,900913),
proposta text,
alternativeproposta boolean,
active boolean,
planocls character varying(24)
);
ALTER TABLE ppgis.plano OWNER TO geobox;
--
-- TOC entry 3818 (class 0 OID 0)
-- Dependencies: 195
-- Name: TABLE plano; Type: COMMENT; Schema: ppgis; Owner: geobox
--
COMMENT ON TABLE plano IS 'If plano.the_geom exists, then the disuccsion is map based, with one geographic feature for each participation
If plano.proposta exists, then the discussion is about something without geographic features
If plano.proposta exists, the promotor can decide if alternative text forms can be provided by citizens, using the plano.alternativetext (yes or no)';
--
-- TOC entry 196 (class 1259 OID 45796)
-- Name: plano_id_seq; Type: SEQUENCE; Schema: ppgis; Owner: geobox
--
CREATE SEQUENCE plano_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE ppgis.plano_id_seq OWNER TO geobox;
--
-- TOC entry 3819 (class 0 OID 0)
-- Dependencies: 196
-- Name: plano_id_seq; Type: SEQUENCE OWNED BY; Schema: ppgis; Owner: geobox
--
ALTER SEQUENCE plano_id_seq OWNED BY plano.id;
--
-- TOC entry 197 (class 1259 OID 45798)
-- Name: promotor; Type: TABLE; Schema: ppgis; Owner: geobox; Tablespace:
--
CREATE TABLE promotor (
id integer NOT NULL,
designacao character varying(100) NOT NULL,
email character varying(50) NOT NULL,
site character varying(120),
dataregisto timestamp with time zone DEFAULT now() NOT NULL,
datamodificacao timestamp with time zone DEFAULT now() NOT NULL,
idutilizador integer NOT NULL,
logotipo character varying(255),
active boolean DEFAULT true
);
ALTER TABLE ppgis.promotor OWNER TO geobox;
--
-- TOC entry 198 (class 1259 OID 45806)
-- Name: promotor_id_seq; Type: SEQUENCE; Schema: ppgis; Owner: geobox
--
CREATE SEQUENCE promotor_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE ppgis.promotor_id_seq OWNER TO geobox;
--
-- TOC entry 3820 (class 0 OID 0)
-- Dependencies: 198
-- Name: promotor_id_seq; Type: SEQUENCE OWNED BY; Schema: ppgis; Owner: geobox
--
ALTER SEQUENCE promotor_id_seq OWNED BY promotor.id;
--
-- TOC entry 199 (class 1259 OID 45808)
-- Name: tipoocorrencia; Type: TABLE; Schema: ppgis; Owner: geobox; Tablespace:
--
CREATE TABLE tipoocorrencia (
id integer NOT NULL,
idplano integer NOT NULL,
designacao character varying(100) NOT NULL,
ativa boolean DEFAULT true,
datamodificacao timestamp with time zone DEFAULT now() NOT NULL,
idutilizador integer NOT NULL,
classe integer
);
ALTER TABLE ppgis.tipoocorrencia OWNER TO geobox;
SET search_path = public, pg_catalog;
--
-- TOC entry 200 (class 1259 OID 45813)
-- Name: grupo; Type: TABLE; Schema: public; Owner: geobox; Tablespace:
--
CREATE TABLE grupo (
id integer NOT NULL,
nome character varying(45) NOT NULL,
datacriacao timestamp with time zone DEFAULT now(),
datamodificacao timestamp with time zone,
idutilizador integer,
omissao boolean DEFAULT false NOT NULL
);
ALTER TABLE public.grupo OWNER TO geobox;
--
-- TOC entry 201 (class 1259 OID 45817)
-- Name: grupo_id_seq; Type: SEQUENCE; Schema: public; Owner: geobox
--
CREATE SEQUENCE grupo_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.grupo_id_seq OWNER TO geobox;
--
-- TOC entry 3821 (class 0 OID 0)
-- Dependencies: 201
-- Name: grupo_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: geobox
--
ALTER SEQUENCE grupo_id_seq OWNED BY grupo.id;
--
-- TOC entry 210 (class 1259 OID 46188)
-- Name: menu; Type: TABLE; Schema: public; Owner: geobox; Tablespace:
--
CREATE TABLE menu (
id integer NOT NULL,
titulo character varying(45) NOT NULL,
icon character varying(15),
idsuperior integer,
extjsview character varying(45),
anonimo boolean DEFAULT false
);
ALTER TABLE public.menu OWNER TO geobox;
--
-- TOC entry 211 (class 1259 OID 46192)
-- Name: menu_id_seq; Type: SEQUENCE; Schema: public; Owner: geobox
--
CREATE SEQUENCE menu_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.menu_id_seq OWNER TO geobox;
--
-- TOC entry 3822 (class 0 OID 0)
-- Dependencies: 211
-- Name: menu_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: geobox
--
ALTER SEQUENCE menu_id_seq OWNED BY menu.id;
--
-- TOC entry 208 (class 1259 OID 46165)
-- Name: tema; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE tema (
ord bigint,
titulo character varying(120),
layer character varying(76),
grupo character varying(120),
url character varying(512),
tipo character varying(48),
srid bigint,
estilo character varying(255),
qtip character varying(255),
singletile boolean,
activo boolean,
observacoes character varying(255),
visivel boolean,
dataalteracao timestamp without time zone DEFAULT now() NOT NULL,
id integer NOT NULL,
datacriacao timestamp with time zone DEFAULT now(),
datamodificacao timestamp with time zone,
idutilizador integer,
base boolean DEFAULT false,
idplano integer
);
ALTER TABLE public.tema OWNER TO geobox;
--
-- TOC entry 209 (class 1259 OID 46174)
-- Name: pdm_id_seq1; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE pdm_id_seq1
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.pdm_id_seq1 OWNER TO geobox;
--
-- TOC entry 3823 (class 0 OID 0)
-- Dependencies: 209
-- Name: pdm_id_seq1; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE pdm_id_seq1 OWNED BY tema.id;
--
-- TOC entry 212 (class 1259 OID 46194)
-- Name: permissao; Type: TABLE; Schema: public; Owner: geobox; Tablespace:
--
CREATE TABLE permissao (
idmenu integer NOT NULL,
idgrupo integer NOT NULL
);
ALTER TABLE public.permissao OWNER TO geobox;
--
-- TOC entry 202 (class 1259 OID 45828)
-- Name: social; Type: TABLE; Schema: public; Owner: geobox; Tablespace:
--
CREATE TABLE social (
id integer NOT NULL,
nome character varying(20),
appkey character varying(80)
);
ALTER TABLE public.social OWNER TO geobox;
--
-- TOC entry 203 (class 1259 OID 45831)
-- Name: redesocial_id_seq; Type: SEQUENCE; Schema: public; Owner: geobox
--
CREATE SEQUENCE redesocial_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.redesocial_id_seq OWNER TO geobox;
--
-- TOC entry 3824 (class 0 OID 0)
-- Dependencies: 203
-- Name: redesocial_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: geobox
--
ALTER SEQUENCE redesocial_id_seq OWNED BY social.id;
--
-- TOC entry 204 (class 1259 OID 45833)
-- Name: sessao; Type: TABLE; Schema: public; Owner: geobox; Tablespace:
--
CREATE TABLE sessao (
id integer NOT NULL,
userid integer NOT NULL,
sessionid character varying(24),
datalogin timestamp with time zone DEFAULT now(),
datalogout timestamp with time zone,
ativo boolean DEFAULT true,
ip character varying(45),
hostname character varying(45),
dataultimaatividade timestamp with time zone DEFAULT now(),
browser character varying(120),
reaproveitada integer DEFAULT 0,
socialid integer
);
ALTER TABLE public.sessao OWNER TO geobox;
--
-- TOC entry 205 (class 1259 OID 45840)
-- Name: sessao_id_seq; Type: SEQUENCE; Schema: public; Owner: geobox
--
CREATE SEQUENCE sessao_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.sessao_id_seq OWNER TO geobox;
--
-- TOC entry 3825 (class 0 OID 0)
-- Dependencies: 205
-- Name: sessao_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: geobox
--
ALTER SEQUENCE sessao_id_seq OWNED BY sessao.id;
--
-- TOC entry 206 (class 1259 OID 45842)
-- Name: utilizador; Type: TABLE; Schema: public; Owner: geobox; Tablespace:
--
CREATE TABLE utilizador (
id integer NOT NULL,
login character varying(20),
password character varying(100),
idgrupo integer,
email character varying(100),
fotografia character varying(1024),
nome character varying(120) NOT NULL,
morada character varying(80),
localidade character varying(80),
codpostal character varying(8),
despostal character varying(80),
nif character varying(9),
nic character varying(9),
masculino boolean,
pessoacoletiva boolean,
telemovel character varying(15),
telefone character varying(15),
observacoes text,
dicofre character varying(6),
ponto geometry(Point,3763),
datacriacao timestamp with time zone DEFAULT now(),
datamodificacao timestamp with time zone DEFAULT now(),
ultimologin timestamp with time zone,
preferencias hstore,
ativo boolean DEFAULT true,
emailconfirmacao boolean DEFAULT false,
token character varying(64),
CONSTRAINT enforce_dims_geometria CHECK ((st_ndims(ponto) = 2)),
CONSTRAINT enforce_geotype_geometria CHECK (((geometrytype(ponto) = 'POINT'::text) OR (ponto IS NULL))),
CONSTRAINT enforce_srid_geometria CHECK ((st_srid(ponto) = 3763))
);
ALTER TABLE public.utilizador OWNER TO geobox;
--
-- TOC entry 207 (class 1259 OID 45855)
-- Name: utilizador_id_seq; Type: SEQUENCE; Schema: public; Owner: geobox
--
CREATE SEQUENCE utilizador_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.utilizador_id_seq OWNER TO geobox;
--
-- TOC entry 3826 (class 0 OID 0)
-- Dependencies: 207
-- Name: utilizador_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: geobox
--
ALTER SEQUENCE utilizador_id_seq OWNED BY utilizador.id;
SET search_path = ppgis, pg_catalog;
--
-- TOC entry 3584 (class 2604 OID 45857)
-- Name: id; Type: DEFAULT; Schema: ppgis; Owner: geobox
--
ALTER TABLE ONLY comentario ALTER COLUMN id SET DEFAULT nextval('comentario_id_seq'::regclass);
--
-- TOC entry 3589 (class 2604 OID 45858)
-- Name: id; Type: DEFAULT; Schema: ppgis; Owner: geobox
--
ALTER TABLE ONLY fotografia ALTER COLUMN id SET DEFAULT nextval('fotografia_id_seq'::regclass);
--
-- TOC entry 3594 (class 2604 OID 45859)
-- Name: id; Type: DEFAULT; Schema: ppgis; Owner: geobox
--
ALTER TABLE ONLY fotografiatmp ALTER COLUMN id SET DEFAULT nextval('fotografiatmp_id_seq'::regclass);
--
-- TOC entry 3598 (class 2604 OID 45860)
-- Name: id; Type: DEFAULT; Schema: ppgis; Owner: geobox
--
ALTER TABLE ONLY ocorrencia ALTER COLUMN id SET DEFAULT nextval('ocorrencia_id_seq'::regclass);
--
-- TOC entry 3605 (class 2604 OID 45861)
-- Name: id; Type: DEFAULT; Schema: ppgis; Owner: geobox
--
ALTER TABLE ONLY plano ALTER COLUMN id SET DEFAULT nextval('plano_id_seq'::regclass);
--
-- TOC entry 3608 (class 2604 OID 45862)
-- Name: id; Type: DEFAULT; Schema: ppgis; Owner: geobox
--
ALTER TABLE ONLY promotor ALTER COLUMN id SET DEFAULT nextval('promotor_id_seq'::regclass);
SET search_path = public, pg_catalog;
--
-- TOC entry 3613 (class 2604 OID 46197)
-- Name: id; Type: DEFAULT; Schema: public; Owner: geobox
--
ALTER TABLE ONLY grupo ALTER COLUMN id SET DEFAULT nextval('grupo_id_seq'::regclass);
--
-- TOC entry 3634 (class 2604 OID 46198)
-- Name: id; Type: DEFAULT; Schema: public; Owner: geobox
--
ALTER TABLE ONLY menu ALTER COLUMN id SET DEFAULT nextval('menu_id_seq'::regclass);
--
-- TOC entry 3620 (class 2604 OID 45865)
-- Name: id; Type: DEFAULT; Schema: public; Owner: geobox
--
ALTER TABLE ONLY sessao ALTER COLUMN id SET DEFAULT nextval('sessao_id_seq'::regclass);
--
-- TOC entry 3615 (class 2604 OID 45866)
-- Name: id; Type: DEFAULT; Schema: public; Owner: geobox
--
ALTER TABLE ONLY social ALTER COLUMN id SET DEFAULT nextval('redesocial_id_seq'::regclass);
--
-- TOC entry 3632 (class 2604 OID 46199)
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY tema ALTER COLUMN id SET DEFAULT nextval('pdm_id_seq1'::regclass);
--
-- TOC entry 3625 (class 2604 OID 45867)
-- Name: id; Type: DEFAULT; Schema: public; Owner: geobox
--
ALTER TABLE ONLY utilizador ALTER COLUMN id SET DEFAULT nextval('utilizador_id_seq'::regclass);
SET search_path = ppgis, pg_catalog;
--
-- TOC entry 3636 (class 2606 OID 45869)
-- Name: comentario_pkey; Type: CONSTRAINT; Schema: ppgis; Owner: geobox; Tablespace:
--
ALTER TABLE ONLY comentario
ADD CONSTRAINT comentario_pkey PRIMARY KEY (id);
--
-- TOC entry 3638 (class 2606 OID 45871)
-- Name: estado_pkey; Type: CONSTRAINT; Schema: ppgis; Owner: geobox; Tablespace:
--
ALTER TABLE ONLY estado
ADD CONSTRAINT estado_pkey PRIMARY KEY (id, idplano);
--
-- TOC entry 3640 (class 2606 OID 45873)
-- Name: fotografia_pk; Type: CONSTRAINT; Schema: ppgis; Owner: geobox; Tablespace:
--
ALTER TABLE ONLY fotografia
ADD CONSTRAINT fotografia_pk PRIMARY KEY (id);
--
-- TOC entry 3642 (class 2606 OID 45875)
-- Name: fotografiatmp_pk; Type: CONSTRAINT; Schema: ppgis; Owner: geobox; Tablespace:
--
ALTER TABLE ONLY fotografiatmp
ADD CONSTRAINT fotografiatmp_pk PRIMARY KEY (id);
--
-- TOC entry 3644 (class 2606 OID 45877)
-- Name: ocorrencia_pkey; Type: CONSTRAINT; Schema: ppgis; Owner: geobox; Tablespace:
--
ALTER TABLE ONLY ocorrencia
ADD CONSTRAINT ocorrencia_pkey PRIMARY KEY (id);
--
-- TOC entry 3646 (class 2606 OID 45879)
-- Name: plano_pkey; Type: CONSTRAINT; Schema: ppgis; Owner: geobox; Tablespace:
--
ALTER TABLE ONLY plano
ADD CONSTRAINT plano_pkey PRIMARY KEY (id);
--
-- TOC entry 3648 (class 2606 OID 45881)
-- Name: promotor_pkey; Type: CONSTRAINT; Schema: ppgis; Owner: geobox; Tablespace:
--
ALTER TABLE ONLY promotor
ADD CONSTRAINT promotor_pkey PRIMARY KEY (id);
--
-- TOC entry 3650 (class 2606 OID 45883)
-- Name: tipoocorrencia_pkey; Type: CONSTRAINT; Schema: ppgis; Owner: geobox; Tablespace:
--
ALTER TABLE ONLY tipoocorrencia
ADD CONSTRAINT tipoocorrencia_pkey PRIMARY KEY (id, idplano);
SET search_path = public, pg_catalog;
--
-- TOC entry 3652 (class 2606 OID 45885)
-- Name: grupo_pkey; Type: CONSTRAINT; Schema: public; Owner: geobox; Tablespace:
--
ALTER TABLE ONLY grupo
ADD CONSTRAINT grupo_pkey PRIMARY KEY (id);
--
-- TOC entry 3664 (class 2606 OID 46180)
-- Name: layer_pk; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY tema
ADD CONSTRAINT layer_pk PRIMARY KEY (id);
--
-- TOC entry 3666 (class 2606 OID 46201)
-- Name: menu_pkey; Type: CONSTRAINT; Schema: public; Owner: geobox; Tablespace:
--
ALTER TABLE ONLY menu
ADD CONSTRAINT menu_pkey PRIMARY KEY (id);
--
-- TOC entry 3668 (class 2606 OID 46203)
-- Name: permissao_pk; Type: CONSTRAINT; Schema: public; Owner: geobox; Tablespace:
--
ALTER TABLE ONLY permissao
ADD CONSTRAINT permissao_pk PRIMARY KEY (idmenu, idgrupo);
--
-- TOC entry 3654 (class 2606 OID 45889)
-- Name: redesocial_pkey; Type: CONSTRAINT; Schema: public; Owner: geobox; Tablespace:
--
ALTER TABLE ONLY social
ADD CONSTRAINT redesocial_pkey PRIMARY KEY (id);
--
-- TOC entry 3656 (class 2606 OID 45891)
-- Name: sessao_pkey; Type: CONSTRAINT; Schema: public; Owner: geobox; Tablespace:
--
ALTER TABLE ONLY sessao
ADD CONSTRAINT sessao_pkey PRIMARY KEY (id);
--
-- TOC entry 3660 (class 2606 OID 45893)
-- Name: utilizador_login_key; Type: CONSTRAINT; Schema: public; Owner: geobox; Tablespace:
--
ALTER TABLE ONLY utilizador
ADD CONSTRAINT utilizador_login_key UNIQUE (login);
--
-- TOC entry 3662 (class 2606 OID 45895)
-- Name: utilizador_pkey; Type: CONSTRAINT; Schema: public; Owner: geobox; Tablespace:
--
ALTER TABLE ONLY utilizador
ADD CONSTRAINT utilizador_pkey PRIMARY KEY (id);
--
-- TOC entry 3657 (class 1259 OID 45896)
-- Name: sessao_sessionid_idx; Type: INDEX; Schema: public; Owner: geobox; Tablespace:
--
CREATE INDEX sessao_sessionid_idx ON sessao USING btree (sessionid);
--
-- TOC entry 3658 (class 1259 OID 45897)
-- Name: sessao_userid_idx; Type: INDEX; Schema: public; Owner: geobox; Tablespace:
--
CREATE INDEX sessao_userid_idx ON sessao USING btree (userid);
SET search_path = ppgis, pg_catalog;
--
-- TOC entry 3693 (class 2620 OID 235122)
-- Name: addlayer; Type: TRIGGER; Schema: ppgis; Owner: geobox
--
CREATE TRIGGER addlayer AFTER INSERT ON plano FOR EACH ROW EXECUTE PROCEDURE createdefaultlayer();
--
-- TOC entry 3692 (class 2620 OID 45898)
-- Name: triggerUpdateParticipationState; Type: TRIGGER; Schema: ppgis; Owner: geobox
--
CREATE TRIGGER "triggerUpdateParticipationState" BEFORE INSERT OR UPDATE ON comentario FOR EACH ROW EXECUTE PROCEDURE updateparticipationstate();