Files
dota-random-web/migrations/20260911221511_create_items_table.up.sql
T
kwiialyssa edb4cd8613
CI/CD / Build (push) Successful in 5m59s
CI/CD / Frontend Build (push) Successful in 1m27s
CI/CD / Unit Tests (push) Failing after 1m12s
CI/CD / Docker (push) Skipped
CI/CD / Frontend Docker (push) Failing after 3m29s
feat(DRW-001) initial commit!
2026-09-13 20:37:48 +03:00

15 lines
484 B
SQL

CREATE TYPE item_source AS ENUM ('shop', 'neutral');
CREATE TABLE items (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL UNIQUE,
source item_source NOT NULL,
min_tier SMALLINT,
max_tier SMALLINT,
image_url TEXT NOT NULL,
CONSTRAINT neutral_tier_matches_source CHECK (
(source = 'neutral' AND min_tier BETWEEN 1 AND 5 AND max_tier BETWEEN 1 AND 5 AND min_tier <= max_tier)
OR (source = 'shop' AND min_tier IS NULL AND max_tier IS NULL)
)
);