mirror of
https://github.com/3ybactuk/marketplace-go-service-project.git
synced 2025-10-30 22:13:44 +03:00
20 lines
442 B
SQL
20 lines
442 B
SQL
-- +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; |