← back to Dw Unbuyable Recovery Pilot

tk11041-innovations-reconcile/rescrape/backfill/undo-backfill.sql

18 lines

-- TK-11041 — UNDO for apply-backfill.sql. Exact: prestate was uniformly empty/false (verified).
-- Restores the 39 reprice-cohort rows to their pre-write state.
BEGIN;
UPDATE innovations_catalog ic
   SET shopify_product_id = NULL,
       on_shopify = false
  FROM shopify_products sp
 WHERE upper(ic.mfr_sku) = upper(sp.mfr_sku)
   AND sp.vendor = 'Phillipe Romano'
   AND sp.status = 'ACTIVE'
   AND NOT coalesce(sp.has_product_variant, false)
   AND sp.supplier_name ~* 'innov'
   AND split_part(sp.mfr_sku, '-', 1) <> 'WHL';
-- EXPECT: UPDATE 39
COMMIT;
-- Per-id authoritative restore alternative: backfill/PRESTATE-undo-snapshot.tsv
--   (columns: ic.id, shopify_product_id_before, on_shopify_before)