rename-weighted-total-to-conversion-score.sql
1 -- Migration: Rename weighted_total to conversion_score 2 -- This makes the column name more descriptive and aligns with the domain language 3 4 -- Rename the column 5 ALTER TABLE sites RENAME COLUMN weighted_total TO conversion_score; 6 7 -- Drop old index 8 DROP INDEX IF EXISTS idx_sites_score; 9 10 -- Create new index on renamed column 11 CREATE INDEX IF NOT EXISTS idx_sites_conversion_score ON sites(conversion_score); 12 13 -- Update the config entry that references the old term 14 UPDATE config 15 SET description = 'Sites with conversion_score below this threshold are considered "low-scoring" and eligible for proposal generation' 16 WHERE key = 'low_score_cutoff';