2022-05-18 19:55:31 +00:00
|
|
|
CREATE TABLE products (
|
2022-05-23 21:52:50 +00:00
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
name VARCHAR(250) NOT NULL,
|
|
|
|
price INTEGER NOT NULL
|
2022-05-19 22:38:28 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE users (
|
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
firstName VARCHAR(250) NOT NULL,
|
|
|
|
lastName VARCHAR(250) NOT NULL,
|
|
|
|
username VARCHAR(250) NOT NULL,
|
2022-05-23 21:52:50 +00:00
|
|
|
password VARCHAR(250) NOT NULL
|
2022-05-21 01:51:04 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE orders (
|
2022-05-23 21:52:50 +00:00
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
status VARCHAR(15),
|
|
|
|
user_id INTEGER NOT NULL REFERENCES users(id)
|
2022-05-21 01:51:04 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE order_products (
|
2022-05-23 21:52:50 +00:00
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
quantity INTEGER NOT NULL,
|
|
|
|
order_id INTEGER NOT NULL REFERENCES orders(id),
|
|
|
|
product_id INTEGER NOT NULL REFERENCES products(id)
|
2022-05-21 01:51:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|