-- Migration 000010: Extended equipment slots (head, feet, neck). -- ============================================================ -- Equipment items table (all slots beyond legacy weapon/armor). -- ============================================================ CREATE TABLE IF NOT EXISTS equipment_items ( id BIGSERIAL PRIMARY KEY, slot TEXT NOT NULL, -- gear.slot.head, gear.slot.feet, gear.slot.neck, etc. form_id TEXT NOT NULL DEFAULT '', name TEXT NOT NULL, rarity TEXT NOT NULL DEFAULT 'common', ilvl INT NOT NULL DEFAULT 1, base_primary INT NOT NULL DEFAULT 0, primary_stat INT NOT NULL DEFAULT 0, -- computed: ScalePrimary(base_primary, ilvl, rarity) stat_type TEXT NOT NULL DEFAULT 'defense', -- attack, defense, speed, mixed created_at TIMESTAMPTZ NOT NULL DEFAULT now() ); -- ============================================================ -- Hero equipment (one row per equipped slot). -- ============================================================ CREATE TABLE IF NOT EXISTS hero_equipment ( hero_id BIGINT NOT NULL REFERENCES heroes(id) ON DELETE CASCADE, slot TEXT NOT NULL, item_id BIGINT NOT NULL REFERENCES equipment_items(id), equipped_at TIMESTAMPTZ NOT NULL DEFAULT now(), PRIMARY KEY (hero_id, slot) ); CREATE INDEX IF NOT EXISTS idx_hero_equipment_hero ON hero_equipment(hero_id);