... | @@ -39,11 +39,6 @@ Optamos por usar um banco relacional, pois seria melhor, tendo em vista que o ba |
... | @@ -39,11 +39,6 @@ Optamos por usar um banco relacional, pois seria melhor, tendo em vista que o ba |
|
<table align="left"><tr><td align="left" >
|
|
<table align="left"><tr><td align="left" >
|
|
|
|
|
|
### Tabela Administrator
|
|
### Tabela Administrator
|
|
-- public.administrator definition
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
-- DROP TABLE public.administrator;
|
|
|
|
|
|
|
|
CREATE TABLE public.administrator (
|
|
CREATE TABLE public.administrator (
|
|
|
|
|
... | @@ -55,16 +50,10 @@ CREATE TABLE public.administrator ( |
... | @@ -55,16 +50,10 @@ CREATE TABLE public.administrator ( |
|
PRIMARY KEY (id_adm)
|
|
PRIMARY KEY (id_adm)
|
|
);
|
|
);
|
|
|
|
|
|
-- public.administrator foreign keys
|
|
|
|
|
|
|
|
ALTER TABLE public.administrator ADD CONSTRAINT fk_id_user FOREIGN KEY (id_user) REFERENCES public.users(id_user);
|
|
ALTER TABLE public.administrator ADD CONSTRAINT fk_id_user FOREIGN KEY (id_user) REFERENCES public.users(id_user);
|
|
|
|
|
|
### Tabela Institution
|
|
### Tabela Institution
|
|
-- public.institution definition
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
-- DROP TABLE public.institution;
|
|
|
|
|
|
|
|
CREATE TABLE public.institution (
|
|
CREATE TABLE public.institution (
|
|
|
|
|
... | @@ -91,16 +80,9 @@ CREATE TABLE public.institution ( |
... | @@ -91,16 +80,9 @@ CREATE TABLE public.institution ( |
|
PRIMARY KEY (id_institution)
|
|
PRIMARY KEY (id_institution)
|
|
);
|
|
);
|
|
|
|
|
|
-- public.institution foreign keys
|
|
|
|
|
|
|
|
ALTER TABLE public.institution ADD CONSTRAINT fk_user_institution FOREIGN KEY (id_user) REFERENCES public.users(id_user);
|
|
ALTER TABLE public.institution ADD CONSTRAINT fk_user_institution FOREIGN KEY (id_user) REFERENCES public.users(id_user);
|
|
|
|
|
|
### Tabela Item_Solicitation
|
|
### Tabela Item_Solicitation
|
|
-- public.item_solicitation definition
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
-- DROP TABLE public.item_solicitation;
|
|
|
|
|
|
|
|
CREATE TABLE public.item_solicitation (
|
|
CREATE TABLE public.item_solicitation (
|
|
|
|
|
... | @@ -113,16 +95,9 @@ CREATE TABLE public.item_solicitation ( |
... | @@ -113,16 +95,9 @@ CREATE TABLE public.item_solicitation ( |
|
PRIMARY KEY (id_item_solicitation)
|
|
PRIMARY KEY (id_item_solicitation)
|
|
);
|
|
);
|
|
|
|
|
|
-- public.item_solicitation foreign keys
|
|
|
|
|
|
|
|
ALTER TABLE public.item_solicitation ADD CONSTRAINT fk_id_institution FOREIGN KEY (id_institution) REFERENCES public.institution(id_institution);
|
|
ALTER TABLE public.item_solicitation ADD CONSTRAINT fk_id_institution FOREIGN KEY (id_institution) REFERENCES public.institution(id_institution);
|
|
|
|
|
|
### Tabela Itens
|
|
### Tabela Itens
|
|
-- public.itens definition
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
-- DROP TABLE public.itens;
|
|
|
|
|
|
|
|
CREATE TABLE public.itens (
|
|
CREATE TABLE public.itens (
|
|
|
|
|
... | @@ -135,11 +110,6 @@ CREATE TABLE public.itens ( |
... | @@ -135,11 +110,6 @@ CREATE TABLE public.itens ( |
|
);
|
|
);
|
|
|
|
|
|
### Tabela Product_Details_Order
|
|
### Tabela Product_Details_Order
|
|
-- public.product_details_order definition
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
-- DROP TABLE public.product_details_order;
|
|
|
|
|
|
|
|
CREATE TABLE public.product_details_order (
|
|
CREATE TABLE public.product_details_order (
|
|
|
|
|
... | @@ -154,17 +124,10 @@ CREATE TABLE public.product_details_order ( |
... | @@ -154,17 +124,10 @@ CREATE TABLE public.product_details_order ( |
|
PRIMARY KEY (id_product_details_order)
|
|
PRIMARY KEY (id_product_details_order)
|
|
);
|
|
);
|
|
|
|
|
|
-- public.product_details_order foreign keys
|
|
|
|
|
|
|
|
ALTER TABLE public.product_details_order ADD CONSTRAINT fk_id_institution FOREIGN KEY (id_institution) REFERENCES public.institution(id_institution);
|
|
ALTER TABLE public.product_details_order ADD CONSTRAINT fk_id_institution FOREIGN KEY (id_institution) REFERENCES public.institution(id_institution);
|
|
|
|
|
|
|
|
|
|
### Tabela Product_Interest
|
|
### Tabela Product_Interest
|
|
-- public.product_interest definition
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
-- DROP TABLE public.product_interest;
|
|
|
|
|
|
|
|
CREATE TABLE public.product_interest (
|
|
CREATE TABLE public.product_interest (
|
|
|
|
|
... | @@ -176,18 +139,11 @@ CREATE TABLE public.product_interest ( |
... | @@ -176,18 +139,11 @@ CREATE TABLE public.product_interest ( |
|
PRIMARY KEY (id_product_interest, id_item)
|
|
PRIMARY KEY (id_product_interest, id_item)
|
|
);
|
|
);
|
|
|
|
|
|
-- public.product_interest foreign keys
|
|
|
|
|
|
|
|
ALTER TABLE public.product_interest ADD CONSTRAINT fk8uaemq3seveakutup5mmcb5mb FOREIGN KEY (id_product_order_interest) REFERENCES public.product_order_interest(id_product_order_interest);
|
|
ALTER TABLE public.product_interest ADD CONSTRAINT fk8uaemq3seveakutup5mmcb5mb FOREIGN KEY (id_product_order_interest) REFERENCES public.product_order_interest(id_product_order_interest);
|
|
ALTER TABLE public.product_interest ADD CONSTRAINT product_interest_id_item_fkey FOREIGN KEY (id_item) REFERENCES public.itens(id_item);
|
|
ALTER TABLE public.product_interest ADD CONSTRAINT product_interest_id_item_fkey FOREIGN KEY (id_item) REFERENCES public.itens(id_item);
|
|
|
|
|
|
|
|
|
|
### Tabela Product_Order_Interest
|
|
### Tabela Product_Order_Interest
|
|
-- public.product_order_interest definition
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
-- DROP TABLE public.product_order_interest;
|
|
|
|
|
|
|
|
CREATE TABLE public.product_order_interest (
|
|
CREATE TABLE public.product_order_interest (
|
|
|
|
|
... | @@ -202,18 +158,12 @@ CREATE TABLE public.product_order_interest ( |
... | @@ -202,18 +158,12 @@ CREATE TABLE public.product_order_interest ( |
|
PRIMARY KEY (id_product_order_interest)
|
|
PRIMARY KEY (id_product_order_interest)
|
|
);
|
|
);
|
|
|
|
|
|
-- public.product_order_interest foreign keys
|
|
|
|
|
|
|
|
ALTER TABLE public.product_order_interest ADD CONSTRAINT fk26gn4wcp72y1uioei71qai8jc FOREIGN KEY (id_institution) REFERENCES public.institution(id_institution);
|
|
ALTER TABLE public.product_order_interest ADD CONSTRAINT fk26gn4wcp72y1uioei71qai8jc FOREIGN KEY (id_institution) REFERENCES public.institution(id_institution);
|
|
ALTER TABLE public.product_order_interest ADD CONSTRAINT fkjarf6gmmnmylutf00f8br8pxc FOREIGN KEY (id_product_details_order) REFERENCES public.product_details_order(id_product_details_order);
|
|
ALTER TABLE public.product_order_interest ADD CONSTRAINT fkjarf6gmmnmylutf00f8br8pxc FOREIGN KEY (id_product_details_order) REFERENCES public.product_details_order(id_product_details_order);
|
|
|
|
|
|
|
|
|
|
### Tabela Product_Order_Interest_Lines
|
|
### Tabela Product_Order_Interest_Lines
|
|
-- public.product_order_interest definition
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
-- DROP TABLE public.product_order_interest;
|
|
|
|
|
|
|
|
CREATE TABLE public.product_order_interest (
|
|
CREATE TABLE public.product_order_interest (
|
|
|
|
|
... | @@ -228,18 +178,11 @@ CREATE TABLE public.product_order_interest ( |
... | @@ -228,18 +178,11 @@ CREATE TABLE public.product_order_interest ( |
|
PRIMARY KEY (id_product_order_interest)
|
|
PRIMARY KEY (id_product_order_interest)
|
|
);
|
|
);
|
|
|
|
|
|
-- public.product_order_interest foreign keys
|
|
|
|
|
|
|
|
ALTER TABLE public.product_order_interest ADD CONSTRAINT fk26gn4wcp72y1uioei71qai8jc FOREIGN KEY (id_institution) REFERENCES public.institution(id_institution);
|
|
ALTER TABLE public.product_order_interest ADD CONSTRAINT fk26gn4wcp72y1uioei71qai8jc FOREIGN KEY (id_institution) REFERENCES public.institution(id_institution);
|
|
ALTER TABLE public.product_order_interest ADD CONSTRAINT fkjarf6gmmnmylutf00f8br8pxc FOREIGN KEY (id_product_details_order) REFERENCES public.product_details_order(id_product_details_order);
|
|
ALTER TABLE public.product_order_interest ADD CONSTRAINT fkjarf6gmmnmylutf00f8br8pxc FOREIGN KEY (id_product_details_order) REFERENCES public.product_details_order(id_product_details_order);
|
|
|
|
|
|
|
|
|
|
### Tabela Product_Quantity_Order
|
|
### Tabela Product_Quantity_Order
|
|
-- public.product_quantity_order definition
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
-- DROP TABLE public.product_quantity_order;
|
|
|
|
|
|
|
|
CREATE TABLE public.product_quantity_order (
|
|
CREATE TABLE public.product_quantity_order (
|
|
|
|
|
... | @@ -255,19 +198,12 @@ CREATE TABLE public.product_quantity_order ( |
... | @@ -255,19 +198,12 @@ CREATE TABLE public.product_quantity_order ( |
|
PRIMARY KEY (id_institution, id_product_details_order, id_item)
|
|
PRIMARY KEY (id_institution, id_product_details_order, id_item)
|
|
);
|
|
);
|
|
|
|
|
|
-- public.product_quantity_order foreign keys
|
|
|
|
|
|
|
|
ALTER TABLE public.product_quantity_order ADD CONSTRAINT fk5p6yfpfrrmtcu7vmsgy00mx0a FOREIGN KEY (id_institution) REFERENCES public.institution(id_institution);
|
|
ALTER TABLE public.product_quantity_order ADD CONSTRAINT fk5p6yfpfrrmtcu7vmsgy00mx0a FOREIGN KEY (id_institution) REFERENCES public.institution(id_institution);
|
|
ALTER TABLE public.product_quantity_order ADD CONSTRAINT fk_id_item FOREIGN KEY (id_item) REFERENCES public.itens(id_item);
|
|
ALTER TABLE public.product_quantity_order ADD CONSTRAINT fk_id_item FOREIGN KEY (id_item) REFERENCES public.itens(id_item);
|
|
ALTER TABLE public.product_quantity_order ADD CONSTRAINT fkq6rwtnw2dcsmxiylhk91ha29r FOREIGN KEY (id_product_details_order) REFERENCES public.product_details_order(id_product_details_order);
|
|
ALTER TABLE public.product_quantity_order ADD CONSTRAINT fkq6rwtnw2dcsmxiylhk91ha29r FOREIGN KEY (id_product_details_order) REFERENCES public.product_details_order(id_product_details_order);
|
|
|
|
|
|
|
|
|
|
### Tabela Service
|
|
### Tabela Service
|
|
-- public.service definition
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
-- DROP TABLE public.service;
|
|
|
|
|
|
|
|
CREATE TABLE public.service (
|
|
CREATE TABLE public.service (
|
|
|
|
|
... | @@ -280,11 +216,6 @@ CREATE TABLE public.service ( |
... | @@ -280,11 +216,6 @@ CREATE TABLE public.service ( |
|
|
|
|
|
|
|
|
|
### Tabela Service_Details_Order
|
|
### Tabela Service_Details_Order
|
|
-- public.service_details_order definition
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
-- DROP TABLE public.service_details_order;
|
|
|
|
|
|
|
|
CREATE TABLE public.service_details_order (
|
|
CREATE TABLE public.service_details_order (
|
|
|
|
|
... | @@ -300,17 +231,10 @@ CREATE TABLE public.service_details_order ( |
... | @@ -300,17 +231,10 @@ CREATE TABLE public.service_details_order ( |
|
PRIMARY KEY (id_service_details_order)
|
|
PRIMARY KEY (id_service_details_order)
|
|
);
|
|
);
|
|
|
|
|
|
-- public.service_details_order foreign keys
|
|
|
|
|
|
|
|
ALTER TABLE public.service_details_order ADD CONSTRAINT fk_id_institution FOREIGN KEY (id_institution) REFERENCES public.institution(id_institution);
|
|
ALTER TABLE public.service_details_order ADD CONSTRAINT fk_id_institution FOREIGN KEY (id_institution) REFERENCES public.institution(id_institution);
|
|
|
|
|
|
|
|
|
|
### Tabela Service_Interest
|
|
### Tabela Service_Interest
|
|
-- public.service_interest definition
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
-- DROP TABLE public.service_interest;
|
|
|
|
|
|
|
|
CREATE TABLE public.service_interest (
|
|
CREATE TABLE public.service_interest (
|
|
|
|
|
... | @@ -322,17 +246,10 @@ CREATE TABLE public.service_interest ( |
... | @@ -322,17 +246,10 @@ CREATE TABLE public.service_interest ( |
|
PRIMARY KEY (id_service_interest)
|
|
PRIMARY KEY (id_service_interest)
|
|
);
|
|
);
|
|
|
|
|
|
-- public.service_interest foreign keys
|
|
|
|
|
|
|
|
ALTER TABLE public.service_interest ADD CONSTRAINT fk217hs1gec0eerdr2uvy0301ks FOREIGN KEY (id_service_order_interest) REFERENCES public.service_order_interest(id_service_order_interest);
|
|
ALTER TABLE public.service_interest ADD CONSTRAINT fk217hs1gec0eerdr2uvy0301ks FOREIGN KEY (id_service_order_interest) REFERENCES public.service_order_interest(id_service_order_interest);
|
|
ALTER TABLE public.service_interest ADD CONSTRAINT fkso5g3wlnhy0s6h70a3murhm3w FOREIGN KEY (id_service) REFERENCES public.service(id_service);
|
|
ALTER TABLE public.service_interest ADD CONSTRAINT fkso5g3wlnhy0s6h70a3murhm3w FOREIGN KEY (id_service) REFERENCES public.service(id_service);
|
|
|
|
|
|
### Tabela Service_Order_Interest
|
|
### Tabela Service_Order_Interest
|
|
-- public.service_order_interest definition
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
-- DROP TABLE public.service_order_interest;
|
|
|
|
|
|
|
|
CREATE TABLE public.service_order_interest (
|
|
CREATE TABLE public.service_order_interest (
|
|
|
|
|
... | @@ -347,19 +264,11 @@ CREATE TABLE public.service_order_interest ( |
... | @@ -347,19 +264,11 @@ CREATE TABLE public.service_order_interest ( |
|
PRIMARY KEY (id_service_order_interest)
|
|
PRIMARY KEY (id_service_order_interest)
|
|
);
|
|
);
|
|
|
|
|
|
-- public.service_order_interest foreign keys
|
|
|
|
|
|
|
|
ALTER TABLE public.service_order_interest ADD CONSTRAINT fk1ae2kg6aqtjwoygscfpq0g4b2 FOREIGN KEY (id_service_details_order) REFERENCES public.service_details_order(id_service_details_order);
|
|
ALTER TABLE public.service_order_interest ADD CONSTRAINT fk1ae2kg6aqtjwoygscfpq0g4b2 FOREIGN KEY (id_service_details_order) REFERENCES public.service_details_order(id_service_details_order);
|
|
ALTER TABLE public.service_order_interest ADD CONSTRAINT fkksrqtdfah0im5bay2xbtou6wv FOREIGN KEY (id_institution) REFERENCES public.institution(id_institution);
|
|
ALTER TABLE public.service_order_interest ADD CONSTRAINT fkksrqtdfah0im5bay2xbtou6wv FOREIGN KEY (id_institution) REFERENCES public.institution(id_institution);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Tabela Service_Quantity_Order
|
|
### Tabela Service_Quantity_Order
|
|
-- public.service_quantity_order definition
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
-- DROP TABLE public.service_quantity_order;
|
|
|
|
|
|
|
|
CREATE TABLE public.service_quantity_order (
|
|
CREATE TABLE public.service_quantity_order (
|
|
|
|
|
... | @@ -375,19 +284,12 @@ CREATE TABLE public.service_quantity_order ( |
... | @@ -375,19 +284,12 @@ CREATE TABLE public.service_quantity_order ( |
|
PRIMARY KEY (id_institution, id_service_quantity_order, id_service, id_service_details_order)
|
|
PRIMARY KEY (id_institution, id_service_quantity_order, id_service, id_service_details_order)
|
|
);
|
|
);
|
|
|
|
|
|
-- public.service_quantity_order foreign keys
|
|
|
|
|
|
|
|
ALTER TABLE public.service_quantity_order ADD CONSTRAINT fk_id_service FOREIGN KEY (id_service) REFERENCES public.service(id_service);
|
|
ALTER TABLE public.service_quantity_order ADD CONSTRAINT fk_id_service FOREIGN KEY (id_service) REFERENCES public.service(id_service);
|
|
ALTER TABLE public.service_quantity_order ADD CONSTRAINT fkjvrbu0h6psnqanw5yslqtu6xv FOREIGN KEY (id_institution) REFERENCES public.institution(id_institution);
|
|
ALTER TABLE public.service_quantity_order ADD CONSTRAINT fkjvrbu0h6psnqanw5yslqtu6xv FOREIGN KEY (id_institution) REFERENCES public.institution(id_institution);
|
|
ALTER TABLE public.service_quantity_order ADD CONSTRAINT fkrnho2x8h2w1a25vxsnuf1crau FOREIGN KEY (id_service_details_order) REFERENCES public.service_details_order(id_service_details_order);
|
|
ALTER TABLE public.service_quantity_order ADD CONSTRAINT fkrnho2x8h2w1a25vxsnuf1crau FOREIGN KEY (id_service_details_order) REFERENCES public.service_details_order(id_service_details_order);
|
|
|
|
|
|
|
|
|
|
### Tabela Service_Solicitation
|
|
### Tabela Service_Solicitation
|
|
-- public.service_solicitation definition
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
-- DROP TABLE public.service_solicitation;
|
|
|
|
|
|
|
|
CREATE TABLE public.service_solicitation (
|
|
CREATE TABLE public.service_solicitation (
|
|
|
|
|
... | @@ -400,17 +302,10 @@ CREATE TABLE public.service_solicitation ( |
... | @@ -400,17 +302,10 @@ CREATE TABLE public.service_solicitation ( |
|
PRIMARY KEY (id_service_solicitation)
|
|
PRIMARY KEY (id_service_solicitation)
|
|
);
|
|
);
|
|
|
|
|
|
-- public.service_solicitation foreign keys
|
|
|
|
|
|
|
|
ALTER TABLE public.service_solicitation ADD CONSTRAINT fk_id_institution FOREIGN KEY (id_institution) REFERENCES public.institution(id_institution);
|
|
ALTER TABLE public.service_solicitation ADD CONSTRAINT fk_id_institution FOREIGN KEY (id_institution) REFERENCES public.institution(id_institution);
|
|
|
|
|
|
|
|
|
|
### Tabela Users
|
|
### Tabela Users
|
|
-- public.users definition
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
-- DROP TABLE public.users;
|
|
|
|
|
|
|
|
CREATE TABLE public.users (
|
|
CREATE TABLE public.users (
|
|
|
|
|
... | | ... | |