Created
February 22, 2023 01:46
-
-
Save kendy-karakawa/cb927d9e96ff9394eeded611006ff91e to your computer and use it in GitHub Desktop.
Prática - Modelagem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://dbdesigner.page.link/QPvDgas4e4A3tRGR6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table users ( | |
id serial primary key, | |
"fullName" varchar(100) not null, | |
email text not null unique, | |
password text not null | |
); | |
create table user_adress ( | |
id serial primary key, | |
user_id integer not null references users(id), | |
street text not null, | |
number varchar(10) not null, | |
complement text, | |
postal_code text not null, | |
city text not null, | |
); | |
create table products ( | |
id serial primary key, | |
name text not null, | |
) | |
create table photos( | |
id serial primary key, | |
product_id integer not null references products(id), | |
url text not null, | |
) | |
create table sizes( | |
id serial primary key, | |
product_id integer not null references products(id), | |
size text not null, | |
) | |
create table categorys( | |
id serial primary key, | |
product_id integer not null references products(id), | |
category text not null, | |
) | |
create type "purchaseStatus" as enum ('creates', 'paid', 'delivered', 'canceled'); | |
create table records( | |
id serial primary key, | |
user_id integer not null references users(id), | |
street text not null, | |
number varchar(10) not null, | |
complement text, | |
postal_code text not null, | |
city text not null, | |
product_id integer not null references products(id), | |
size text not null, | |
type "purchaseStatus" not null, | |
date not null default now(), | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment