[object Object]

← back to Japan Enrich

japan: create per-vendor *_catalog tables (promote-queue targets) + pg dep

af6d4f139d842972b283f201f3d857321e4813ba · 2026-07-06 13:53:29 -0700 · Steve

sangetsu/lilycolor/greenland _catalog tables (vendor_catalog-subset shape, UNIQUE
(vendor_code,mfr_sku) for the upsert). Applied to local dw_unified mirror; DDL
file is the gated canonical version for Kamatera. Proved the full queue→--commit
path (us_distributor lands, on_shopify=false), then truncated back to empty.

Files touched

Diff

commit af6d4f139d842972b283f201f3d857321e4813ba
Author: Steve <steve@designerwallcoverings.com>
Date:   Mon Jul 6 13:53:29 2026 -0700

    japan: create per-vendor *_catalog tables (promote-queue targets) + pg dep
    
    sangetsu/lilycolor/greenland _catalog tables (vendor_catalog-subset shape, UNIQUE
    (vendor_code,mfr_sku) for the upsert). Applied to local dw_unified mirror; DDL
    file is the gated canonical version for Kamatera. Proved the full queue→--commit
    path (us_distributor lands, on_shopify=false), then truncated back to empty.
---
 db/create-japan-catalog-tables.sql |  64 +++++++++++++++
 package-lock.json                  | 162 +++++++++++++++++++++++++++++++++++++
 package.json                       |  16 ++++
 3 files changed, 242 insertions(+)

diff --git a/db/create-japan-catalog-tables.sql b/db/create-japan-catalog-tables.sql
new file mode 100644
index 0000000..ad1479e
--- /dev/null
+++ b/db/create-japan-catalog-tables.sql
@@ -0,0 +1,64 @@
+-- Per-vendor staging catalog tables for the Japan lines, matching the DW *_catalog
+-- convention (subset of vendor_catalog columns). Targets of db/promote-import-queue.js.
+-- Additive + reversible (DROP TABLE ...). Safe to run on the local dw_unified mirror;
+-- on canonical Kamatera it's a gated schema step. The UNIQUE (vendor_code, mfr_sku)
+-- is REQUIRED — the promote script upserts ON CONFLICT (vendor_code, mfr_sku).
+
+CREATE TABLE IF NOT EXISTS sangetsu_catalog (
+  id             serial PRIMARY KEY,
+  vendor_code    varchar,
+  mfr_sku        varchar,
+  pattern_name   varchar,
+  color_name     varchar,
+  collection     varchar,
+  product_type   varchar,
+  product_url    text,
+  image_url      text,
+  us_distributor varchar,          -- 'Goodrich (Thailand)' etc. — the buy-from channel
+  specs          jsonb,
+  on_shopify     boolean DEFAULT false,
+  dw_sku         text,
+  first_seen_at  timestamp DEFAULT now(),
+  updated_at     timestamp DEFAULT now(),
+  UNIQUE (vendor_code, mfr_sku)
+);
+
+CREATE TABLE IF NOT EXISTS lilycolor_catalog (
+  id             serial PRIMARY KEY,
+  vendor_code    varchar,
+  mfr_sku        varchar,
+  pattern_name   varchar,
+  color_name     varchar,
+  collection     varchar,
+  product_type   varchar,
+  product_url    text,
+  image_url      text,
+  us_distributor varchar,          -- 'Lilycolor (direct)' — sold direct by the mill
+  specs          jsonb,
+  on_shopify     boolean DEFAULT false,
+  dw_sku         text,
+  first_seen_at  timestamp DEFAULT now(),
+  updated_at     timestamp DEFAULT now(),
+  UNIQUE (vendor_code, mfr_sku)
+);
+
+CREATE TABLE IF NOT EXISTS greenland_catalog (
+  id             serial PRIMARY KEY,
+  vendor_code    varchar,
+  mfr_sku        varchar,
+  pattern_name   varchar,
+  color_name     varchar,
+  collection     varchar,
+  product_type   varchar,
+  product_url    text,
+  image_url      text,
+  us_distributor varchar,          -- 'Greenland (direct)'
+  specs          jsonb,
+  on_shopify     boolean DEFAULT false,
+  dw_sku         text,
+  first_seen_at  timestamp DEFAULT now(),
+  updated_at     timestamp DEFAULT now(),
+  UNIQUE (vendor_code, mfr_sku)
+);
+
+-- Undo:  DROP TABLE IF EXISTS sangetsu_catalog, lilycolor_catalog, greenland_catalog;
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..294aca8
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,162 @@
+{
+  "name": "japan-enrich",
+  "version": "1.0.0",
+  "lockfileVersion": 3,
+  "requires": true,
+  "packages": {
+    "": {
+      "name": "japan-enrich",
+      "version": "1.0.0",
+      "license": "ISC",
+      "dependencies": {
+        "pg": "^8.22.0"
+      }
+    },
+    "node_modules/pg": {
+      "version": "8.22.0",
+      "resolved": "https://registry.npmjs.org/pg/-/pg-8.22.0.tgz",
+      "integrity": "sha512-8wih1vVIBMxoUM2oB4soJsD9tDnDpLv4OXBJ+EJzFsvycD+lfyIreC2gGHq78f8jbLLt+bvlPTFdFZfJkOuzAA==",
+      "license": "MIT",
+      "dependencies": {
+        "pg-connection-string": "^2.14.0",
+        "pg-pool": "^3.14.0",
+        "pg-protocol": "^1.15.0",
+        "pg-types": "2.2.0",
+        "pgpass": "1.0.5"
+      },
+      "engines": {
+        "node": ">= 16.0.0"
+      },
+      "optionalDependencies": {
+        "pg-cloudflare": "^1.4.0"
+      },
+      "peerDependencies": {
+        "pg-native": ">=3.0.1"
+      },
+      "peerDependenciesMeta": {
+        "pg-native": {
+          "optional": true
+        }
+      }
+    },
+    "node_modules/pg-cloudflare": {
+      "version": "1.4.0",
+      "resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.4.0.tgz",
+      "integrity": "sha512-Vo7z/6rrQYxpNRylp4Tlob2elzbh+N/MOQbxFVWCxS7oEx6jF53GTJFxK2WWpKuBRkmiin4Mt+xofFDjx09R0A==",
+      "license": "MIT",
+      "optional": true
+    },
+    "node_modules/pg-connection-string": {
+      "version": "2.14.0",
+      "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.14.0.tgz",
+      "integrity": "sha512-XwWDGcLRGCXAR8F/AM5bG7Q+A3Wm2s6QeEjlOKZLlH3UYcguiqCWKyWXVag5TLTIjR7oOJUY8kcADaZgWPyLeg==",
+      "license": "MIT"
+    },
+    "node_modules/pg-int8": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz",
+      "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==",
+      "license": "ISC",
+      "engines": {
+        "node": ">=4.0.0"
+      }
+    },
+    "node_modules/pg-pool": {
+      "version": "3.14.0",
+      "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.14.0.tgz",
+      "integrity": "sha512-gKtPkFdQPU3DksooVLi9LsjZxrsBUZIpa+7aVx+LV5pNh0KzP4Zleud2po+ConrxbuXGBJ6Hfer6hdgpIBpBaw==",
+      "license": "MIT",
+      "peerDependencies": {
+        "pg": ">=8.0"
+      }
+    },
+    "node_modules/pg-protocol": {
+      "version": "1.15.0",
+      "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.15.0.tgz",
+      "integrity": "sha512-cq9sECI5s0+uPUXjbz8ioyPJni6RzsRib0US67i5IoTZKw8fNeYlVE7u8F4dG7vEJJtc5wdD1K189lCCUwqWTQ==",
+      "license": "MIT"
+    },
+    "node_modules/pg-types": {
+      "version": "2.2.0",
+      "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz",
+      "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==",
+      "license": "MIT",
+      "dependencies": {
+        "pg-int8": "1.0.1",
+        "postgres-array": "~2.0.0",
+        "postgres-bytea": "~1.0.0",
+        "postgres-date": "~1.0.4",
+        "postgres-interval": "^1.1.0"
+      },
+      "engines": {
+        "node": ">=4"
+      }
+    },
+    "node_modules/pgpass": {
+      "version": "1.0.5",
+      "resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz",
+      "integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==",
+      "license": "MIT",
+      "dependencies": {
+        "split2": "^4.1.0"
+      }
+    },
+    "node_modules/postgres-array": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz",
+      "integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==",
+      "license": "MIT",
+      "engines": {
+        "node": ">=4"
+      }
+    },
+    "node_modules/postgres-bytea": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.1.tgz",
+      "integrity": "sha512-5+5HqXnsZPE65IJZSMkZtURARZelel2oXUEO8rH83VS/hxH5vv1uHquPg5wZs8yMAfdv971IU+kcPUczi7NVBQ==",
+      "license": "MIT",
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/postgres-date": {
+      "version": "1.0.7",
+      "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz",
+      "integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==",
+      "license": "MIT",
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/postgres-interval": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz",
+      "integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==",
+      "license": "MIT",
+      "dependencies": {
+        "xtend": "^4.0.0"
+      },
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/split2": {
+      "version": "4.2.0",
+      "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz",
+      "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==",
+      "license": "ISC",
+      "engines": {
+        "node": ">= 10.x"
+      }
+    },
+    "node_modules/xtend": {
+      "version": "4.0.2",
+      "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
+      "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
+      "license": "MIT",
+      "engines": {
+        "node": ">=0.4"
+      }
+    }
+  }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..22b801a
--- /dev/null
+++ b/package.json
@@ -0,0 +1,16 @@
+{
+  "name": "japan-enrich",
+  "version": "1.0.0",
+  "description": "Offline **staging + enrichment + viewer** pipeline for three Asian wallcovering vendors, feeding two host-scoped Designer Wallcoverings microsites:",
+  "main": "index.js",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
+  "keywords": [],
+  "author": "",
+  "license": "ISC",
+  "type": "commonjs",
+  "dependencies": {
+    "pg": "^8.22.0"
+  }
+}

← 9f2be43 japan viewer: import-queue drawer — list queued SKUs, per-ro  ·  back to Japan Enrich  ·  japan: bulk-stage full Sangetsu line into sangetsu_catalog ( efb6472 →