← back to Wallco Ai
migrations/20260601_prompt_match_columns_PROD.sql
32 lines
-- 20260601_prompt_match_columns_PROD.sql
--
-- ⚠️ OBSOLETE / DO NOT RE-RUN (2026-06-01 evening): the topology drift this file
-- worked around has been RESOLVED — prod `spoon_all_designs` is now a VIEW over
-- `all_designs` (converged to match Mac2; see docs/spoon-convergence-migration-plan.md).
-- Its `ALTER TABLE spoon_all_designs ...` statements will now ERROR ("is not a
-- table"). The canonical migration for both envs is the VIEW-based sibling
-- 20260601_prompt_match_columns.sql. Kept for history only.
--
-- PROD variant of 20260601_prompt_match_columns.sql.
--
-- TOPOLOGY DRIFT (discovered 2026-06-01): on PROD dw_unified,
-- `spoon_all_designs` is a real TABLE (relkind=r) carrying the user_* rating
-- columns directly — NOT a view over all_designs as it is on the local Mac2
-- dev DB. The deployed app reads/writes spoon_all_designs everywhere, so on
-- prod we ALTER that table directly. Running the local migration's
-- CREATE OR REPLACE VIEW against prod would ERROR ("spoon_all_designs is not a
-- view"), so this prod file does the table-ALTER only.
--
-- ADDITIVE ONLY, idempotent (IF NOT EXISTS). No drops, no renames. Does NOT
-- touch is_published, the settlement gate, or designs.json sync. Mirrors the
-- existing prod columns user_stars (integer), user_color_good (boolean),
-- user_rated_at (timestamptz).
BEGIN;
ALTER TABLE spoon_all_designs ADD COLUMN IF NOT EXISTS user_prompt_match smallint;
ALTER TABLE spoon_all_designs ADD COLUMN IF NOT EXISTS user_prompt_verdict text;
ALTER TABLE spoon_all_designs ADD COLUMN IF NOT EXISTS user_prompt_rated_at timestamptz;
COMMIT;