You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
464 B
SQL
11 lines
464 B
SQL
-- Backpack: unequipped gear (max 40 slots per hero).
|
|
CREATE TABLE IF NOT EXISTS hero_inventory (
|
|
hero_id BIGINT NOT NULL REFERENCES heroes(id) ON DELETE CASCADE,
|
|
slot_index SMALLINT NOT NULL CHECK (slot_index >= 0 AND slot_index < 40),
|
|
gear_id BIGINT NOT NULL REFERENCES gear(id) ON DELETE CASCADE,
|
|
PRIMARY KEY (hero_id, slot_index),
|
|
UNIQUE (gear_id)
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_hero_inventory_hero ON hero_inventory(hero_id);
|