Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE TABLE IF NOT EXISTS orders
  2. (
  3.     id         BIGSERIAL PRIMARY KEY,
  4.     user_id    BIGINT REFERENCES users (id) NOT NULL,
  5.     created_at DATE                         NOT NULL
  6. );
  7. CREATE TABLE IF NOT EXISTS order_entries
  8. (
  9.     product_id       BIGINT REFERENCES products (id) NOT NULL,
  10.     order_id         BIGINT REFERENCES orders (id)   NOT NULL,
  11.     product_quantity BIGINT                          NOT NULL,
  12.     price            NUMERIC(15, 2)                  NOT NULL,
  13.     total            NUMERIC(15, 2)                  NOT NULL
  14. );
  15. CREATE TABLE IF NOT EXISTS carts
  16. (
  17.     id               BIGSERIAL PRIMARY KEY,
  18.     product_id       BIGINT REFERENCES products (id) NOT NULL,
  19.     product_quantity BIGINT                          NOT NULL,
  20.     user_id          BIGINT REFERENCES users (id)    NOT NULL
  21. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement