CREATE TABLE IF NOT EXISTS wardrobe_items ( wardrobe_item_id TEXT PRIMARY KEY, profile_id TEXT NOT NULL, material_id TEXT NOT NULL, wardrobe_category TEXT NOT NULL, tags_json TEXT, season TEXT, style TEXT, is_favorite INTEGER NOT NULL DEFAULT 0, usage_count INTEGER NOT NULL DEFAULT 0, last_used_at TIMESTAMP, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY(profile_id) REFERENCES character_profiles(profile_id) ON DELETE CASCADE, FOREIGN KEY(material_id) REFERENCES materials(material_id) ON DELETE CASCADE ); CREATE INDEX IF NOT EXISTS idx_wardrobe_profile ON wardrobe_items(profile_id, wardrobe_category); CREATE UNIQUE INDEX IF NOT EXISTS idx_wardrobe_profile_material ON wardrobe_items(profile_id, material_id, wardrobe_category);