-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbanco.sql
More file actions
899 lines (614 loc) · 20.2 KB
/
Copy pathbanco.sql
File metadata and controls
899 lines (614 loc) · 20.2 KB
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
--
-- Dumped from database version 9.3.5
-- Dumped by pg_dump version 9.3.1
-- Started on 2015-04-05 09:00:39
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 2063 (class 1262 OID 12029)
-- Name: postgres; Type: DATABASE; Schema: -; Owner: postgres
--
--CREATE DATABASE postgres WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'Portuguese_Brazil.1252' LC_CTYPE = 'Portuguese_Brazil.1252';
ALTER DATABASE postgres OWNER TO postgres;
--\connect postgres
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 2064 (class 1262 OID 12029)
-- Dependencies: 2063
-- Name: postgres; Type: COMMENT; Schema: -; Owner: postgres
--
COMMENT ON DATABASE postgres IS 'default administrative connection database';
--
-- TOC entry 6 (class 2615 OID 2200)
-- Name: public; Type: SCHEMA; Schema: -; Owner: postgres
--
--CREATE SCHEMA public;
ALTER SCHEMA public OWNER TO postgres;
--
-- TOC entry 2065 (class 0 OID 0)
-- Dependencies: 6
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
--
COMMENT ON SCHEMA public IS 'standard public schema';
--
-- TOC entry 191 (class 3079 OID 11750)
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- TOC entry 2067 (class 0 OID 0)
-- Dependencies: 191
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
--
-- TOC entry 190 (class 3079 OID 16384)
-- Name: adminpack; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS adminpack WITH SCHEMA pg_catalog;
--
-- TOC entry 2068 (class 0 OID 0)
-- Dependencies: 190
-- Name: EXTENSION adminpack; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION adminpack IS 'administrative functions for PostgreSQL';
SET search_path = public, pg_catalog;
--
-- TOC entry 172 (class 1259 OID 32783)
-- Name: cliente; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE cliente (
id integer NOT NULL,
cpf character varying,
nome character varying,
endereco character varying,
telefone character varying,
login character varying,
senha character varying
);
ALTER TABLE public.cliente OWNER TO postgres;
--
-- TOC entry 173 (class 1259 OID 32789)
-- Name: Cliente_ID_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE "Cliente_ID_seq"
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public."Cliente_ID_seq" OWNER TO postgres;
--
-- TOC entry 2069 (class 0 OID 0)
-- Dependencies: 173
-- Name: Cliente_ID_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE "Cliente_ID_seq" OWNED BY cliente.id;
--
-- TOC entry 174 (class 1259 OID 32791)
-- Name: funcionario; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE funcionario (
salario double precision,
cpf character varying,
nome character varying,
endereco character varying,
telefone character varying,
data_de_demissao date,
data_de_entrada date,
id integer NOT NULL,
login character varying,
senha character varying,
administrador boolean DEFAULT false NOT NULL,
CONSTRAINT data_de_entrada_not_null CHECK ((data_de_entrada IS NOT NULL)),
CONSTRAINT entrada_antes_de_demissao CHECK (((data_de_demissao IS NULL) OR (data_de_entrada <= data_de_demissao)))
);
ALTER TABLE public.funcionario OWNER TO postgres;
--
-- TOC entry 175 (class 1259 OID 32799)
-- Name: Funcionario_ID_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE "Funcionario_ID_seq"
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public."Funcionario_ID_seq" OWNER TO postgres;
--
-- TOC entry 2070 (class 0 OID 0)
-- Dependencies: 175
-- Name: Funcionario_ID_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE "Funcionario_ID_seq" OWNED BY funcionario.id;
--
-- TOC entry 176 (class 1259 OID 32801)
-- Name: ingrediente; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE ingrediente (
id integer NOT NULL,
quantidadeestoque integer,
nome character varying,
unidade character varying
);
ALTER TABLE public.ingrediente OWNER TO postgres;
--
-- TOC entry 177 (class 1259 OID 32807)
-- Name: Ingrediente_ID_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE "Ingrediente_ID_seq"
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public."Ingrediente_ID_seq" OWNER TO postgres;
--
-- TOC entry 2071 (class 0 OID 0)
-- Dependencies: 177
-- Name: Ingrediente_ID_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE "Ingrediente_ID_seq" OWNED BY ingrediente.id;
--
-- TOC entry 178 (class 1259 OID 32809)
-- Name: itemdemenu; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE itemdemenu (
id integer NOT NULL,
nome character varying,
preco real,
categoria character varying,
quantidadeestoque integer
);
ALTER TABLE public.itemdemenu OWNER TO postgres;
--
-- TOC entry 179 (class 1259 OID 32815)
-- Name: ItemDeMenu_ID_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE "ItemDeMenu_ID_seq"
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public."ItemDeMenu_ID_seq" OWNER TO postgres;
--
-- TOC entry 2072 (class 0 OID 0)
-- Dependencies: 179
-- Name: ItemDeMenu_ID_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE "ItemDeMenu_ID_seq" OWNED BY itemdemenu.id;
--
-- TOC entry 180 (class 1259 OID 32817)
-- Name: itempossuiingrediente; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE itempossuiingrediente (
id integer NOT NULL,
quantidade integer,
item integer,
ingrediente integer
);
ALTER TABLE public.itempossuiingrediente OWNER TO postgres;
--
-- TOC entry 181 (class 1259 OID 32820)
-- Name: Item_possui_Ingrediente_ID_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE "Item_possui_Ingrediente_ID_seq"
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public."Item_possui_Ingrediente_ID_seq" OWNER TO postgres;
--
-- TOC entry 2073 (class 0 OID 0)
-- Dependencies: 181
-- Name: Item_possui_Ingrediente_ID_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE "Item_possui_Ingrediente_ID_seq" OWNED BY itempossuiingrediente.id;
--
-- TOC entry 182 (class 1259 OID 32822)
-- Name: mesa; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE mesa (
id integer NOT NULL,
numero integer,
lugares integer
);
ALTER TABLE public.mesa OWNER TO postgres;
--
-- TOC entry 183 (class 1259 OID 32825)
-- Name: Mesa_ID_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE "Mesa_ID_seq"
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public."Mesa_ID_seq" OWNER TO postgres;
--
-- TOC entry 2074 (class 0 OID 0)
-- Dependencies: 183
-- Name: Mesa_ID_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE "Mesa_ID_seq" OWNED BY mesa.id;
--
-- TOC entry 184 (class 1259 OID 32827)
-- Name: pedido; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE pedido (
data timestamp without time zone,
endereco character varying,
observacoes character varying,
id integer NOT NULL,
cliente integer
);
ALTER TABLE public.pedido OWNER TO postgres;
--
-- TOC entry 185 (class 1259 OID 32833)
-- Name: Pedido_ID_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE "Pedido_ID_seq"
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public."Pedido_ID_seq" OWNER TO postgres;
--
-- TOC entry 2075 (class 0 OID 0)
-- Dependencies: 185
-- Name: Pedido_ID_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE "Pedido_ID_seq" OWNED BY pedido.id;
--
-- TOC entry 186 (class 1259 OID 32835)
-- Name: pedidopossuiitem; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE pedidopossuiitem (
id integer NOT NULL,
pedido integer,
item integer
);
ALTER TABLE public.pedidopossuiitem OWNER TO postgres;
--
-- TOC entry 187 (class 1259 OID 32838)
-- Name: Pedido_possui_item_ID_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE "Pedido_possui_item_ID_seq"
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public."Pedido_possui_item_ID_seq" OWNER TO postgres;
--
-- TOC entry 2076 (class 0 OID 0)
-- Dependencies: 187
-- Name: Pedido_possui_item_ID_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE "Pedido_possui_item_ID_seq" OWNED BY pedidopossuiitem.id;
--
-- TOC entry 188 (class 1259 OID 32840)
-- Name: reserva; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE reserva (
id integer NOT NULL,
reserva_cliente_fk integer,
reserva_mesa_fk integer,
data timestamp without time zone
);
ALTER TABLE public.reserva OWNER TO postgres;
--
-- TOC entry 189 (class 1259 OID 32843)
-- Name: reserva_ID_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE "reserva_ID_seq"
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public."reserva_ID_seq" OWNER TO postgres;
--
-- TOC entry 2077 (class 0 OID 0)
-- Dependencies: 189
-- Name: reserva_ID_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE "reserva_ID_seq" OWNED BY reserva.id;
--
-- TOC entry 1885 (class 2604 OID 32845)
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY cliente ALTER COLUMN id SET DEFAULT nextval('"Cliente_ID_seq"'::regclass);
--
-- TOC entry 1886 (class 2604 OID 32846)
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY funcionario ALTER COLUMN id SET DEFAULT nextval('"Funcionario_ID_seq"'::regclass);
--
-- TOC entry 1890 (class 2604 OID 32847)
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY ingrediente ALTER COLUMN id SET DEFAULT nextval('"Ingrediente_ID_seq"'::regclass);
--
-- TOC entry 1891 (class 2604 OID 32848)
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY itemdemenu ALTER COLUMN id SET DEFAULT nextval('"ItemDeMenu_ID_seq"'::regclass);
--
-- TOC entry 1892 (class 2604 OID 32849)
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY itempossuiingrediente ALTER COLUMN id SET DEFAULT nextval('"Item_possui_Ingrediente_ID_seq"'::regclass);
--
-- TOC entry 1893 (class 2604 OID 32850)
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY mesa ALTER COLUMN id SET DEFAULT nextval('"Mesa_ID_seq"'::regclass);
--
-- TOC entry 1894 (class 2604 OID 32851)
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY pedido ALTER COLUMN id SET DEFAULT nextval('"Pedido_ID_seq"'::regclass);
--
-- TOC entry 1895 (class 2604 OID 32852)
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY pedidopossuiitem ALTER COLUMN id SET DEFAULT nextval('"Pedido_possui_item_ID_seq"'::regclass);
--
-- TOC entry 1896 (class 2604 OID 32853)
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY reserva ALTER COLUMN id SET DEFAULT nextval('"reserva_ID_seq"'::regclass);
--
-- TOC entry 2078 (class 0 OID 0)
-- Dependencies: 173
-- Name: Cliente_ID_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('"Cliente_ID_seq"', 1, false);
--
-- TOC entry 2079 (class 0 OID 0)
-- Dependencies: 175
-- Name: Funcionario_ID_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('"Funcionario_ID_seq"', 1, false);
--
-- TOC entry 2080 (class 0 OID 0)
-- Dependencies: 177
-- Name: Ingrediente_ID_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('"Ingrediente_ID_seq"', 1, false);
--
-- TOC entry 2081 (class 0 OID 0)
-- Dependencies: 179
-- Name: ItemDeMenu_ID_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('"ItemDeMenu_ID_seq"', 1, false);
--
-- TOC entry 2082 (class 0 OID 0)
-- Dependencies: 181
-- Name: Item_possui_Ingrediente_ID_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('"Item_possui_Ingrediente_ID_seq"', 1, false);
--
-- TOC entry 2083 (class 0 OID 0)
-- Dependencies: 183
-- Name: Mesa_ID_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('"Mesa_ID_seq"', 1, false);
--
-- TOC entry 2084 (class 0 OID 0)
-- Dependencies: 185
-- Name: Pedido_ID_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('"Pedido_ID_seq"', 1, false);
--
-- TOC entry 2085 (class 0 OID 0)
-- Dependencies: 187
-- Name: Pedido_possui_item_ID_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('"Pedido_possui_item_ID_seq"', 1, false);
--
-- TOC entry 2041 (class 0 OID 32783)
-- Dependencies: 172
-- Data for Name: cliente; Type: TABLE DATA; Schema: public; Owner: postgres
--
--
-- TOC entry 2043 (class 0 OID 32791)
-- Dependencies: 174
-- Data for Name: funcionario; Type: TABLE DATA; Schema: public; Owner: postgres
--
--
-- TOC entry 2045 (class 0 OID 32801)
-- Dependencies: 176
-- Data for Name: ingrediente; Type: TABLE DATA; Schema: public; Owner: postgres
--
--
-- TOC entry 2047 (class 0 OID 32809)
-- Dependencies: 178
-- Data for Name: itemdemenu; Type: TABLE DATA; Schema: public; Owner: postgres
--
--
-- TOC entry 2049 (class 0 OID 32817)
-- Dependencies: 180
-- Data for Name: itempossuiingrediente; Type: TABLE DATA; Schema: public; Owner: postgres
--
--
-- TOC entry 2051 (class 0 OID 32822)
-- Dependencies: 182
-- Data for Name: mesa; Type: TABLE DATA; Schema: public; Owner: postgres
--
--
-- TOC entry 2053 (class 0 OID 32827)
-- Dependencies: 184
-- Data for Name: pedido; Type: TABLE DATA; Schema: public; Owner: postgres
--
--
-- TOC entry 2055 (class 0 OID 32835)
-- Dependencies: 186
-- Data for Name: pedidopossuiitem; Type: TABLE DATA; Schema: public; Owner: postgres
--
--
-- TOC entry 2057 (class 0 OID 32840)
-- Dependencies: 188
-- Data for Name: reserva; Type: TABLE DATA; Schema: public; Owner: postgres
--
--
-- TOC entry 2086 (class 0 OID 0)
-- Dependencies: 189
-- Name: reserva_ID_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('"reserva_ID_seq"', 1, false);
--
-- TOC entry 1912 (class 2606 OID 32855)
-- Name: Item_pk; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY itemdemenu
ADD CONSTRAINT "Item_pk" PRIMARY KEY (id);
--
-- TOC entry 1914 (class 2606 OID 32857)
-- Name: Item_possui_pk; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY itempossuiingrediente
ADD CONSTRAINT "Item_possui_pk" PRIMARY KEY (id);
--
-- TOC entry 1922 (class 2606 OID 32859)
-- Name: Pedido_possui_pk; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY pedidopossuiitem
ADD CONSTRAINT "Pedido_possui_pk" PRIMARY KEY (id);
--
-- TOC entry 1898 (class 2606 OID 32861)
-- Name: cliente_login_unique; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY cliente
ADD CONSTRAINT cliente_login_unique UNIQUE (login);
--
-- TOC entry 1900 (class 2606 OID 32863)
-- Name: cpf_unique; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY cliente
ADD CONSTRAINT cpf_unique UNIQUE (cpf);
--
-- TOC entry 1904 (class 2606 OID 32865)
-- Name: funcionario_cpf_unique; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY funcionario
ADD CONSTRAINT funcionario_cpf_unique UNIQUE (cpf);
--
-- TOC entry 1906 (class 2606 OID 32867)
-- Name: funcionario_login_unique; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY funcionario
ADD CONSTRAINT funcionario_login_unique UNIQUE (login);
--
-- TOC entry 1908 (class 2606 OID 32869)
-- Name: funcionario_pk; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY funcionario
ADD CONSTRAINT funcionario_pk PRIMARY KEY (id);
--
-- TOC entry 1910 (class 2606 OID 32871)
-- Name: ingrediente_pk; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY ingrediente
ADD CONSTRAINT ingrediente_pk PRIMARY KEY (id);
--
-- TOC entry 1916 (class 2606 OID 32873)
-- Name: mesa_pk; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY mesa
ADD CONSTRAINT mesa_pk PRIMARY KEY (id);
--
-- TOC entry 1924 (class 2606 OID 32875)
-- Name: no_duas_reservas_ao_mesmo_tempo_por_mesa; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY reserva
ADD CONSTRAINT no_duas_reservas_ao_mesmo_tempo_por_mesa UNIQUE (reserva_mesa_fk, data);
--
-- TOC entry 1918 (class 2606 OID 32877)
-- Name: numero_unique; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY mesa
ADD CONSTRAINT numero_unique UNIQUE (numero);
--
-- TOC entry 1920 (class 2606 OID 32879)
-- Name: pedido_pk; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY pedido
ADD CONSTRAINT pedido_pk PRIMARY KEY (id);
--
-- TOC entry 1902 (class 2606 OID 32881)
-- Name: pk; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY cliente
ADD CONSTRAINT pk PRIMARY KEY (id);
--
-- TOC entry 1926 (class 2606 OID 32883)
-- Name: reserva_pk; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY reserva
ADD CONSTRAINT reserva_pk PRIMARY KEY (id);
--
-- TOC entry 1929 (class 2606 OID 32884)
-- Name: Cliente_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY pedido
ADD CONSTRAINT "Cliente_fk" FOREIGN KEY (cliente) REFERENCES cliente(id);
--
-- TOC entry 1927 (class 2606 OID 32889)
-- Name: Ingrediente_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY itempossuiingrediente
ADD CONSTRAINT "Ingrediente_fk" FOREIGN KEY (ingrediente) REFERENCES ingrediente(id);
--
-- TOC entry 1928 (class 2606 OID 32894)
-- Name: Item_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY itempossuiingrediente
ADD CONSTRAINT "Item_fk" FOREIGN KEY (item) REFERENCES itemdemenu(id);
--
-- TOC entry 1930 (class 2606 OID 32899)
-- Name: Item_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY pedidopossuiitem
ADD CONSTRAINT "Item_fk" FOREIGN KEY (item) REFERENCES itemdemenu(id);
--
-- TOC entry 1931 (class 2606 OID 32904)
-- Name: Pedido_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY pedidopossuiitem
ADD CONSTRAINT "Pedido_fk" FOREIGN KEY (pedido) REFERENCES pedido(id);
--
-- TOC entry 1932 (class 2606 OID 32909)
-- Name: reserva_cliente_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY reserva
ADD CONSTRAINT reserva_cliente_fk FOREIGN KEY (reserva_cliente_fk) REFERENCES cliente(id);
--
-- TOC entry 1933 (class 2606 OID 32914)
-- Name: reserva_mesa_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY reserva
ADD CONSTRAINT reserva_mesa_fk FOREIGN KEY (reserva_mesa_fk) REFERENCES mesa(id);
--
-- TOC entry 2066 (class 0 OID 0)
-- Dependencies: 6
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--
REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;
INSERT INTO funcionario (salario, cpf, nome, endereco, telefone, data_de_demissao, data_de_entrada, id, login, senha, administrador) VALUES (40000, '11111111111', 'admin', 'admin_endereco', 'admin_telefon', NULL, '2015-04-10', 3, 'admin', 'admin', true);