You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Shelf/migrations/sqls/20220520025053-shelf-up.sql

30 lines
780 B
SQL

CREATE TABLE products (
id SERIAL PRIMARY KEY,
name VARCHAR(250) NOT NULL,
price INTEGER NOT NULL
);
CREATE TABLE users (
id SERIAL PRIMARY KEY,
firstName VARCHAR(250) NOT NULL,
lastName VARCHAR(250) NOT NULL,
username VARCHAR(250) NOT NULL,
password VARCHAR(250) NOT NULL
);
CREATE TABLE orders (
id SERIAL PRIMARY KEY,
status VARCHAR(15),
user_id INTEGER NOT NULL REFERENCES users(id)
);
CREATE TABLE order_products (
id SERIAL PRIMARY KEY,
quantity INTEGER NOT NULL,
order_id INTEGER NOT NULL REFERENCES orders(id),
product_id INTEGER NOT NULL REFERENCES products(id)
)