... | ... | @@ -3,7 +3,6 @@ |
|
|
|
|
|
# Banco de Dados
|
|
|
|
|
|
<table align="center"><tr><td align="center" >
|
|
|
|
|
|
## Descrição
|
|
|
|
... | ... | @@ -41,7 +40,9 @@ Optamos por usar um banco relacional, pois seria melhor, tendo em vista que o ba |
|
|
|
|
|
### Tabela Administrator
|
|
|
-- public.administrator definition
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
-- DROP TABLE public.administrator;
|
|
|
|
|
|
CREATE TABLE public.administrator (
|
... | ... | @@ -50,7 +51,8 @@ CREATE TABLE public.administrator ( |
|
|
name varchar(200) NOT NULL,
|
|
|
email varchar(200) NOT NULL,
|
|
|
id_adm int4 NOT NULL,
|
|
|
CONSTRAINT administrator_pk PRIMARY KEY (id_adm)
|
|
|
CONSTRAINT administrator_pk
|
|
|
PRIMARY KEY (id_adm)
|
|
|
);
|
|
|
|
|
|
-- public.administrator foreign keys
|
... | ... | @@ -59,7 +61,9 @@ ALTER TABLE public.administrator ADD CONSTRAINT fk_id_user FOREIGN KEY (id_user) |
|
|
|
|
|
### Tabela Institution
|
|
|
-- public.institution definition
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
-- DROP TABLE public.institution;
|
|
|
|
|
|
CREATE TABLE public.institution (
|
... | ... | @@ -83,7 +87,8 @@ CREATE TABLE public.institution ( |
|
|
description varchar(255) NOT NULL,
|
|
|
cep varchar(255) NOT NULL,
|
|
|
district varchar(255) NOT NULL,
|
|
|
CONSTRAINT pk_institution PRIMARY KEY (id_institution)
|
|
|
CONSTRAINT pk_institution
|
|
|
PRIMARY KEY (id_institution)
|
|
|
);
|
|
|
|
|
|
-- public.institution foreign keys
|
... | ... | @@ -92,7 +97,9 @@ ALTER TABLE public.institution ADD CONSTRAINT fk_user_institution FOREIGN KEY (i |
|
|
|
|
|
### Tabela Item_Solicitation
|
|
|
-- public.item_solicitation definition
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
-- DROP TABLE public.item_solicitation;
|
|
|
|
|
|
CREATE TABLE public.item_solicitation (
|
... | ... | @@ -102,7 +109,8 @@ CREATE TABLE public.item_solicitation ( |
|
|
created_time date NOT NULL,
|
|
|
item varchar(255) NOT NULL,
|
|
|
status varchar(1) NOT NULL,
|
|
|
CONSTRAINT pk_item_solicitation PRIMARY KEY (id_item_solicitation)
|
|
|
CONSTRAINT pk_item_solicitation
|
|
|
PRIMARY KEY (id_item_solicitation)
|
|
|
);
|
|
|
|
|
|
-- public.item_solicitation foreign keys
|
... | ... | @@ -111,7 +119,9 @@ ALTER TABLE public.item_solicitation ADD CONSTRAINT fk_id_institution FOREIGN KE |
|
|
|
|
|
### Tabela Itens
|
|
|
-- public.itens definition
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
-- DROP TABLE public.itens;
|
|
|
|
|
|
CREATE TABLE public.itens (
|
... | ... | @@ -120,12 +130,15 @@ CREATE TABLE public.itens ( |
|
|
"name" varchar(255) NOT NULL,
|
|
|
limit_itens int4 NOT NULL,
|
|
|
unit_measurement varchar(255) NOT NULL,
|
|
|
CONSTRAINT pk_itens PRIMARY KEY (id_item)
|
|
|
CONSTRAINT pk_itens
|
|
|
PRIMARY KEY (id_item)
|
|
|
);
|
|
|
|
|
|
### Tabela Product_Details_Order
|
|
|
-- public.product_details_order definition
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
-- DROP TABLE public.product_details_order;
|
|
|
|
|
|
CREATE TABLE public.product_details_order (
|
... | ... | @@ -137,7 +150,8 @@ CREATE TABLE public.product_details_order ( |
|
|
limit_date date NOT NULL,
|
|
|
status varchar(1) NOT NULL,
|
|
|
description varchar(512) NULL,
|
|
|
CONSTRAINT pk_id_product_details_order PRIMARY KEY (id_product_details_order)
|
|
|
CONSTRAINT pk_id_product_details_order
|
|
|
PRIMARY KEY (id_product_details_order)
|
|
|
);
|
|
|
|
|
|
-- public.product_details_order foreign keys
|
... | ... | @@ -147,7 +161,9 @@ ALTER TABLE public.product_details_order ADD CONSTRAINT fk_id_institution FOREIG |
|
|
|
|
|
### Tabela Product_Interest
|
|
|
-- public.product_interest definition
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
-- DROP TABLE public.product_interest;
|
|
|
|
|
|
CREATE TABLE public.product_interest (
|
... | ... | @@ -156,7 +172,8 @@ CREATE TABLE public.product_interest ( |
|
|
id_item int4 NOT NULL,
|
|
|
quantity int4 NOT NULL,
|
|
|
id_product_order_interest int4 NULL,
|
|
|
CONSTRAINT product_interest_pkey PRIMARY KEY (id_product_interest, id_item)
|
|
|
CONSTRAINT product_interest_pkey
|
|
|
PRIMARY KEY (id_product_interest, id_item)
|
|
|
);
|
|
|
|
|
|
-- public.product_interest foreign keys
|
... | ... | @@ -167,7 +184,9 @@ ALTER TABLE public.product_interest ADD CONSTRAINT product_interest_id_item_fkey |
|
|
|
|
|
### Tabela Product_Order_Interest
|
|
|
-- public.product_order_interest definition
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
-- DROP TABLE public.product_order_interest;
|
|
|
|
|
|
CREATE TABLE public.product_order_interest (
|
... | ... | @@ -179,7 +198,8 @@ CREATE TABLE public.product_order_interest ( |
|
|
phone varchar(255) NULL,
|
|
|
id_institution int4 NULL,
|
|
|
id_product_details_order int4 NULL,
|
|
|
CONSTRAINT product_order_interest_pkey PRIMARY KEY (id_product_order_interest)
|
|
|
CONSTRAINT product_order_interest_pkey
|
|
|
PRIMARY KEY (id_product_order_interest)
|
|
|
);
|
|
|
|
|
|
-- public.product_order_interest foreign keys
|
... | ... | @@ -190,7 +210,9 @@ ALTER TABLE public.product_order_interest ADD CONSTRAINT fkjarf6gmmnmylutf00f8br |
|
|
|
|
|
### Tabela Product_Order_Interest_Lines
|
|
|
-- public.product_order_interest definition
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
-- DROP TABLE public.product_order_interest;
|
|
|
|
|
|
CREATE TABLE public.product_order_interest (
|
... | ... | @@ -202,7 +224,8 @@ CREATE TABLE public.product_order_interest ( |
|
|
phone varchar(255) NULL,
|
|
|
id_institution int4 NULL,
|
|
|
id_product_details_order int4 NULL,
|
|
|
CONSTRAINT product_order_interest_pkey PRIMARY KEY (id_product_order_interest)
|
|
|
CONSTRAINT product_order_interest_pkey
|
|
|
PRIMARY KEY (id_product_order_interest)
|
|
|
);
|
|
|
|
|
|
-- public.product_order_interest foreign keys
|
... | ... | @@ -213,7 +236,9 @@ ALTER TABLE public.product_order_interest ADD CONSTRAINT fkjarf6gmmnmylutf00f8br |
|
|
|
|
|
### Tabela Product_Quantity_Order
|
|
|
-- public.product_quantity_order definition
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
-- DROP TABLE public.product_quantity_order;
|
|
|
|
|
|
CREATE TABLE public.product_quantity_order (
|
... | ... | @@ -226,7 +251,8 @@ CREATE TABLE public.product_quantity_order ( |
|
|
qtd_products_solicited int4 NOT NULL,
|
|
|
id_product_quantity_order int4 NOT NULL,
|
|
|
observations varchar(500) NULL,
|
|
|
CONSTRAINT pk_id_product_quantity_order PRIMARY KEY (id_institution, id_product_details_order, id_item)
|
|
|
CONSTRAINT pk_id_product_quantity_order
|
|
|
PRIMARY KEY (id_institution, id_product_details_order, id_item)
|
|
|
);
|
|
|
|
|
|
-- public.product_quantity_order foreign keys
|
... | ... | @@ -238,7 +264,9 @@ ALTER TABLE public.product_quantity_order ADD CONSTRAINT fkq6rwtnw2dcsmxiylhk91h |
|
|
|
|
|
### Tabela Service
|
|
|
-- public.service definition
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
-- DROP TABLE public.service;
|
|
|
|
|
|
CREATE TABLE public.service (
|
... | ... | @@ -246,13 +274,16 @@ CREATE TABLE public.service ( |
|
|
id_service int4 NOT NULL,
|
|
|
"name" varchar(255) NOT NULL,
|
|
|
limit_service int4 NOT NULL,
|
|
|
CONSTRAINT pk_service PRIMARY KEY (id_service)
|
|
|
CONSTRAINT pk_service
|
|
|
PRIMARY KEY (id_service)
|
|
|
);
|
|
|
|
|
|
|
|
|
### Tabela Service_Details_Order
|
|
|
-- public.service_details_order definition
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
-- DROP TABLE public.service_details_order;
|
|
|
|
|
|
CREATE TABLE public.service_details_order (
|
... | ... | @@ -265,7 +296,8 @@ CREATE TABLE public.service_details_order ( |
|
|
status varchar(1) NOT NULL,
|
|
|
description varchar(512) NULL,
|
|
|
is_active bool NULL,
|
|
|
CONSTRAINT pk_id_service_details_order PRIMARY KEY (id_service_details_order)
|
|
|
CONSTRAINT pk_id_service_details_order
|
|
|
PRIMARY KEY (id_service_details_order)
|
|
|
);
|
|
|
|
|
|
-- public.service_details_order foreign keys
|
... | ... | @@ -275,7 +307,9 @@ ALTER TABLE public.service_details_order ADD CONSTRAINT fk_id_institution FOREIG |
|
|
|
|
|
### Tabela Service_Interest
|
|
|
-- public.service_interest definition
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
-- DROP TABLE public.service_interest;
|
|
|
|
|
|
CREATE TABLE public.service_interest (
|
... | ... | @@ -284,7 +318,8 @@ CREATE TABLE public.service_interest ( |
|
|
quantity int4 NULL,
|
|
|
id_service int4 NULL,
|
|
|
id_service_order_interest int4 NULL,
|
|
|
CONSTRAINT service_interest_pkey PRIMARY KEY (id_service_interest)
|
|
|
CONSTRAINT service_interest_pkey
|
|
|
PRIMARY KEY (id_service_interest)
|
|
|
);
|
|
|
|
|
|
-- public.service_interest foreign keys
|
... | ... | @@ -294,7 +329,9 @@ ALTER TABLE public.service_interest ADD CONSTRAINT fkso5g3wlnhy0s6h70a3murhm3w F |
|
|
|
|
|
### Tabela Service_Order_Interest
|
|
|
-- public.service_order_interest definition
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
-- DROP TABLE public.service_order_interest;
|
|
|
|
|
|
CREATE TABLE public.service_order_interest (
|
... | ... | @@ -306,7 +343,8 @@ CREATE TABLE public.service_order_interest ( |
|
|
phone varchar(255) NULL,
|
|
|
id_institution int4 NULL,
|
|
|
id_service_details_order int4 NULL,
|
|
|
CONSTRAINT service_order_interest_pkey PRIMARY KEY (id_service_order_interest)
|
|
|
CONSTRAINT service_order_interest_pkey
|
|
|
PRIMARY KEY (id_service_order_interest)
|
|
|
);
|
|
|
|
|
|
-- public.service_order_interest foreign keys
|
... | ... | @@ -318,7 +356,9 @@ ALTER TABLE public.service_order_interest ADD CONSTRAINT fkksrqtdfah0im5bay2xbto |
|
|
|
|
|
### Tabela Service_Quantity_Order
|
|
|
-- public.service_quantity_order definition
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
-- DROP TABLE public.service_quantity_order;
|
|
|
|
|
|
CREATE TABLE public.service_quantity_order (
|
... | ... | @@ -331,7 +371,8 @@ CREATE TABLE public.service_quantity_order ( |
|
|
qtd_service_missing int4 NOT NULL,
|
|
|
qtd_service_solicited int4 NOT NULL,
|
|
|
observations varchar(500) NULL,
|
|
|
CONSTRAINT pk_id_service_quantity_order PRIMARY KEY (id_institution, id_service_quantity_order, id_service, id_service_details_order)
|
|
|
CONSTRAINT pk_id_service_quantity_order
|
|
|
PRIMARY KEY (id_institution, id_service_quantity_order, id_service, id_service_details_order)
|
|
|
);
|
|
|
|
|
|
-- public.service_quantity_order foreign keys
|
... | ... | @@ -343,7 +384,9 @@ ALTER TABLE public.service_quantity_order ADD CONSTRAINT fkrnho2x8h2w1a25vxsnuf1 |
|
|
|
|
|
### Tabela Service_Solicitation
|
|
|
-- public.service_solicitation definition
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
-- DROP TABLE public.service_solicitation;
|
|
|
|
|
|
CREATE TABLE public.service_solicitation (
|
... | ... | @@ -353,7 +396,8 @@ CREATE TABLE public.service_solicitation ( |
|
|
created_time date NOT NULL,
|
|
|
service varchar(255) NOT NULL,
|
|
|
status varchar(255) NULL,
|
|
|
CONSTRAINT pk_service_solicitation PRIMARY KEY (id_service_solicitation)
|
|
|
CONSTRAINT pk_service_solicitation
|
|
|
PRIMARY KEY (id_service_solicitation)
|
|
|
);
|
|
|
|
|
|
-- public.service_solicitation foreign keys
|
... | ... | @@ -363,7 +407,9 @@ ALTER TABLE public.service_solicitation ADD CONSTRAINT fk_id_institution FOREIGN |
|
|
|
|
|
### Tabela Users
|
|
|
-- public.users definition
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
-- DROP TABLE public.users;
|
|
|
|
|
|
CREATE TABLE public.users (
|
... | ... | @@ -372,5 +418,6 @@ CREATE TABLE public.users ( |
|
|
login varchar(150) NOT NULL,
|
|
|
"password" varchar(150) NOT NULL,
|
|
|
isadmin bool NULL,
|
|
|
CONSTRAINT pk_users PRIMARY KEY (id_user)
|
|
|
CONSTRAINT pk_users
|
|
|
PRIMARY KEY (id_user)
|
|
|
); |
|
|
\ No newline at end of file |