[object Object]

← back to Naturaltextilewallpaper

naturaltextilewallpaper: add read-only image_url resync dry-run SQL (TK-10371 diagnosis)

c16e65728751dc9057f219abf820b02a9dc0104f · 2026-08-08 08:47:20 -0700 · Steve Abrams

Files touched

Diff

commit c16e65728751dc9057f219abf820b02a9dc0104f
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Sat Aug 8 08:47:20 2026 -0700

    naturaltextilewallpaper: add read-only image_url resync dry-run SQL (TK-10371 diagnosis)
---
 scripts/resync-images-dryrun.sql | 54 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/scripts/resync-images-dryrun.sql b/scripts/resync-images-dryrun.sql
new file mode 100644
index 0000000..1a3945d
--- /dev/null
+++ b/scripts/resync-images-dryrun.sql
@@ -0,0 +1,54 @@
+-- ============================================================================
+-- naturaltextilewallpaper — image_url re-sync DRY-RUN (READ-ONLY, TK-10371)
+-- Runs on the Mac2-local dw_unified mirror. Prints what the canonical UPDATEs
+-- WOULD change. No writes. Safe to run repeatedly.
+-- ============================================================================
+
+\echo '== A. Current image-health breakdown (by live Shopify status) =='
+WITH ntw AS (
+  SELECT id, handle, image_url AS ms_img, visible
+    FROM microsite_products WHERE site_slug='naturaltextilewallpaper'
+)
+SELECT
+  COALESCE(sp.status,'(no shopify match)')                                   status,
+  count(*)                                                                   ntw_rows,
+  count(*) FILTER (WHERE ntw.visible)                                        visible_now,
+  count(*) FILTER (WHERE sp.image_url IS NOT NULL AND sp.image_url<>''
+                     AND sp.image_url<>ntw.ms_img)                           img_would_change,
+  count(*) FILTER (WHERE sp.image_url IS NULL OR sp.image_url='')            sp_img_blank
+FROM ntw LEFT JOIN shopify_products sp ON sp.handle = ntw.handle
+GROUP BY sp.status ORDER BY ntw_rows DESC;
+
+\echo '== B. PART 1 target set — ACTIVE handles whose image_url is stale (would be refreshed) =='
+WITH ntw AS (
+  SELECT id, handle, image_url AS ms_img
+    FROM microsite_products WHERE site_slug='naturaltextilewallpaper'
+)
+SELECT count(*) AS part1_active_img_updates
+FROM ntw JOIN shopify_products sp ON sp.handle = ntw.handle
+WHERE sp.status='ACTIVE'
+  AND sp.image_url IS NOT NULL AND sp.image_url<>''
+  AND sp.image_url<>ntw.ms_img;
+
+\echo '== C. PART 2 target set — ARCHIVED / DUPLICATE_IMPORT handles still visible (would be hidden) =='
+WITH ntw AS (
+  SELECT id, handle, visible
+    FROM microsite_products WHERE site_slug='naturaltextilewallpaper'
+)
+SELECT sp.status, count(*) AS part2_would_hide
+FROM ntw JOIN shopify_products sp ON sp.handle = ntw.handle
+WHERE ntw.visible = true
+  AND sp.status IN ('ARCHIVED','DUPLICATE_IMPORT')
+GROUP BY sp.status ORDER BY 2 DESC;
+
+\echo '== D. Post-remediation projection — visible rows remaining + their sp image coverage =='
+WITH ntw AS (
+  SELECT id, handle, image_url AS ms_img, visible
+    FROM microsite_products WHERE site_slug='naturaltextilewallpaper'
+)
+SELECT
+  count(*) FILTER (WHERE sp.status='ACTIVE')                                        remain_visible_active,
+  count(*) FILTER (WHERE sp.status='ACTIVE' AND sp.image_url IS NOT NULL
+                     AND sp.image_url<>'')                                          active_with_image,
+  count(*) FILTER (WHERE sp.status='DRAFT')                                         draft_kept
+FROM ntw LEFT JOIN shopify_products sp ON sp.handle = ntw.handle;

← 55a29af catalog: scope to real on-domain products only  ·  back to Naturaltextilewallpaper  ·  TK-10371: regenerate products.json from live feed (1466->192 b30311f →