neon-sprawl/server/db/migrations/V005__player_inventory.sql

13 lines
632 B
SQL

-- NEO-54: per-player inventory occupied slots (sparse; empty slots implied).
CREATE TABLE IF NOT EXISTS player_inventory (
player_id TEXT NOT NULL REFERENCES player_position(player_id) ON DELETE CASCADE,
container_kind TEXT NOT NULL CHECK (container_kind IN ('bag', 'equipment')),
slot_index INTEGER NOT NULL,
item_id TEXT NOT NULL,
quantity INTEGER NOT NULL CHECK (quantity > 0),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
PRIMARY KEY (player_id, container_kind, slot_index)
);
COMMENT ON TABLE player_inventory IS 'Persisted occupied inventory slots per player (NEO-54); bag 0-23, equipment 0.';