← back to Greenland Onboard
tag-updater: source from DB (authoritative hue/style), fixes undefined tags
e9e1bae83c6bbe4cf4f78ef1910a50dad89e254d · 2026-07-12 11:56:19 -0700 · Steve Abrams
Files touched
M scripts/update-tags.mjs
Diff
commit e9e1bae83c6bbe4cf4f78ef1910a50dad89e254d
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Sun Jul 12 11:56:19 2026 -0700
tag-updater: source from DB (authoritative hue/style), fixes undefined tags
---
scripts/update-tags.mjs | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/scripts/update-tags.mjs b/scripts/update-tags.mjs
index dc6dca9..ae8165a 100644
--- a/scripts/update-tags.mjs
+++ b/scripts/update-tags.mjs
@@ -28,19 +28,17 @@ async function put(path, body, tries = 5) {
throw new Error('429 exhausted');
}
-// id map from DB
-const idmap = new Map(JSON.parse(execSync(
- `psql "${DB}" -tAc "select coalesce(json_agg(json_build_object('s',dw_sku,'p',shopify_product_id))::text,'[]') from greenland_full_catalog where shopify_product_id is not null"`,
- { encoding: 'utf8', maxBuffer: 64e6 }).trim()).map(x => [x.s, x.p]));
-
-const rows = JSON.parse(readFileSync(join(ROOT, 'data', 'enriched.json'), 'utf8')).filter(r => idmap.has(r.dwSku));
+// source EVERYTHING from the DB (authoritative — enriched.json can drift)
+const rows = JSON.parse(execSync(
+ `psql "${DB}" -tAc "select coalesce(json_agg(json_build_object('pid',shopify_product_id,'sku',dw_sku,'material',material,'city',city,'color',clean_color,'hex',hex,'hue',hue,'style',style))::text,'[]') from greenland_full_catalog where shopify_product_id is not null"`,
+ { encoding: 'utf8', maxBuffer: 128e6 }).trim());
console.log(`updating ${rows.length} live products with Style/Color/Hue/Hex`);
let ok = 0, fail = 0;
for (const r of rows) {
- const pid = idmap.get(r.dwSku);
+ const pid = r.pid;
const tags = [
r.material, r.city, 'Phillipe Romano', 'quotes',
- `Style: ${r.style}`, `Color: ${r.cleanColor}`, `Hue: ${r.hue}`, `Hex: ${r.hex}`,
+ `Style: ${r.style}`, `Color: ${r.color}`, `Hue: ${r.hue}`, `Hex: ${r.hex}`,
].filter(Boolean).join(', ');
try {
// tags only — Hex/Style/Color/Hue live in the tag set; skip custom.* metafields
← 6ab7e31 Add cork enrichment: 213 Cork-500xxx locally enriched (PIL m
·
back to Greenland Onboard
·
Greenland Cork: sync staging dw_sku to canonical Cork- schem 4f22ce7 →