[object Object]

← back to Hollywood Import

momentum go-live prep (blockers 2-4): momentum_golive_prep companion table — hw_product_type + faithful hw_title + panel_spec; leak-clean; reversible

cb4b29233929d90527e9ac0a1025c3e157dda253 · 2026-07-08 15:34:25 -0700 · steve@designerwallcoverings.com

Files touched

Diff

commit cb4b29233929d90527e9ac0a1025c3e157dda253
Author: steve@designerwallcoverings.com <steve@designerwallcoverings.com>
Date:   Wed Jul 8 15:34:25 2026 -0700

    momentum go-live prep (blockers 2-4): momentum_golive_prep companion table — hw_product_type + faithful hw_title + panel_spec; leak-clean; reversible
---
 momentum-feed/prep-golive.mjs | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/momentum-feed/prep-golive.mjs b/momentum-feed/prep-golive.mjs
index 1246b1a..c95b0ee 100644
--- a/momentum-feed/prep-golive.mjs
+++ b/momentum-feed/prep-golive.mjs
@@ -40,17 +40,20 @@ async function main() {
   if (leak != 0) { console.error('ABORT: leak hits > 0 — scrub required before prep.'); await pool.end(); process.exit(1); }
   const c = await pool.connect(); let done = 0;
   try {
-    await c.query(`ALTER TABLE momentum_colorways
-      ADD COLUMN IF NOT EXISTS hw_product_type text,
-      ADD COLUMN IF NOT EXISTS hw_title text,
-      ADD COLUMN IF NOT EXISTS panel_spec text`);
+    // momentum_colorways is owned by legacy role stevestudio2 → no DDL. Use a dw_admin-owned
+    // companion table keyed on the colorway id (drop it to fully reverse).
+    await c.query(`CREATE TABLE IF NOT EXISTS momentum_golive_prep (
+      colorway_id int PRIMARY KEY, dw_sku text, hw_product_type text, hw_title text, panel_spec text, updated_at timestamptz DEFAULT now())`);
     await c.query('BEGIN');
     for (const p of plan) {
-      await c.query(`UPDATE momentum_colorways SET hw_product_type=$1, hw_title=$2, panel_spec=$3, updated_at=now() WHERE id=$4`,
-        [p.pt, p.title, p.spec, p.id]); done++;
+      await c.query(`INSERT INTO momentum_golive_prep (colorway_id, dw_sku, hw_product_type, hw_title, panel_spec, updated_at)
+        SELECT $1, dw_sku, $2, $3, $4, now() FROM momentum_colorways WHERE id=$1
+        ON CONFLICT (colorway_id) DO UPDATE SET hw_product_type=EXCLUDED.hw_product_type,
+          hw_title=EXCLUDED.hw_title, panel_spec=EXCLUDED.panel_spec, dw_sku=EXCLUDED.dw_sku, updated_at=now()`,
+        [p.id, p.pt, p.title, p.spec]); done++;
     }
     await c.query('COMMIT');
-    console.log(`COMMITTED — set hw_product_type/hw_title/panel_spec on ${done} rows. (staging; pattern_name untouched)`);
+    console.log(`COMMITTED — momentum_golive_prep populated for ${done} rows. (companion table; momentum_colorways untouched)`);
   } catch (e) { await c.query('ROLLBACK'); console.error('ROLLBACK:', e.message); process.exitCode = 1; }
   finally { c.release(); await pool.end(); }
 }

← 57e3dbe momentum go-live prep (blockers 2-4): hw_product_type (Acous  ·  back to Hollywood Import  ·  acoustic go-live: manifest (2623, 0-leak validated) + hollyw 3544add →