[hw-4] add postgres db

This commit is contained in:
Никита Шубин
2025-06-26 12:08:46 +00:00
parent 3ebaad5558
commit 77ed9fcf85
46 changed files with 1582 additions and 369 deletions

View File

@@ -0,0 +1,20 @@
-- +goose Up
CREATE TABLE
orders (
id bigserial PRIMARY KEY,
status_name TEXT NOT NULL DEFAULT '',
user_id BIGINT NOT NULL
);
CREATE TABLE
order_items (
id bigserial PRIMARY KEY,
order_id BIGINT NOT NULL REFERENCES orders (id) ON DELETE CASCADE,
sku BIGINT NOT NULL,
COUNT BIGINT NOT NULL CHECK (COUNT > 0)
);
-- +goose Down
DROP TABLE order_items;
DROP TABLE orders;