Skip to content

Instantly share code, notes, and snippets.

@kendy-karakawa
Created February 22, 2023 01:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kendy-karakawa/cb927d9e96ff9394eeded611006ff91e to your computer and use it in GitHub Desktop.
Save kendy-karakawa/cb927d9e96ff9394eeded611006ff91e to your computer and use it in GitHub Desktop.
Prática - Modelagem
https://dbdesigner.page.link/QPvDgas4e4A3tRGR6
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