| Line 1... |
Line 1... |
| 1 |
-- =====================================================================
|
1 |
-- =====================================================================
|
| 2 |
-- External API v2: category specs, client->category exposure,
|
2 |
-- External API v2: category specs, client->category exposure,
|
| 3 |
-- brand identifier. Apply BEFORE deploying the build that maps them.
|
3 |
-- brand identifier. Apply BEFORE deploying the build that maps them.
|
| - |
|
4 |
--
|
| - |
|
5 |
-- STATUS: sections 1-5 + Mongo categoryId backfill APPLIED ON PROD
|
| - |
|
6 |
-- (hadb1 + shop2020 content Mongo) 2026-08-04..10. Staging (saholic-test)
|
| - |
|
7 |
-- NOT applied — run this file there before any staging deploy of >= r37204.
|
| - |
|
8 |
-- Spec-value derivation (POST /content/specs/derive?categoryId=10006/10007)
|
| - |
|
9 |
-- still pending on prod.
|
| 4 |
-- =====================================================================
|
10 |
-- =====================================================================
|
| 5 |
|
11 |
|
| 6 |
-- 1. Category spec vocabulary (keys governed per category) -------------
|
12 |
-- 1. Category spec vocabulary (keys governed per category) -------------
|
| 7 |
CREATE TABLE catalog.category_spec_definition (
|
13 |
CREATE TABLE catalog.category_spec_definition (
|
| 8 |
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
14 |
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
| Line 44... |
Line 50... |
| 44 |
-- Docs without categoryId are INVISIBLE to the category-scoped
|
50 |
-- Docs without categoryId are INVISIBLE to the category-scoped
|
| 45 |
-- catalogMaster; run this right after deploy. Generates one updateOne
|
51 |
-- catalogMaster; run this right after deploy. Generates one updateOne
|
| 46 |
-- per doc; pipe the output into the mongo shell on the content Mongo
|
52 |
-- per doc; pipe the output into the mongo shell on the content Mongo
|
| 47 |
-- (prod content Mongo is on shop2020, NOT 192.168.142.217).
|
53 |
-- (prod content Mongo is on shop2020, NOT 192.168.142.217).
|
| 48 |
--
|
54 |
--
|
| 49 |
-- mysql -N -e "SELECT CONCAT('db.siteContent.updateOne({_id:', c.id,
|
55 |
-- mysql -N -e "SELECT CONCAT('db.siteContent.update({_id:', c.id,
|
| 50 |
-- '},{\$set:{categoryId:NumberInt(', c.category_id, ')}});')
|
56 |
-- '},{\$set:{categoryId:NumberInt(', c.category_id, ')}});')
|
| 51 |
-- FROM catalog.catalog c" > /tmp/mongo_category_backfill.js
|
57 |
-- FROM catalog.catalog c" > /tmp/mongo_category_backfill.js
|
| 52 |
-- mongo <content-db> /tmp/mongo_category_backfill.js
|
58 |
-- mongo <content-db> /tmp/mongo_category_backfill.js
|
| 53 |
--
|
59 |
--
|
| - |
|
60 |
-- NOTE: legacy update(), NOT updateOne() — the prod mongo shell (3.x on
|
| - |
|
61 |
-- shop2020) has no updateOne on DBCollection; updateOne fails mid-script.
|
| - |
|
62 |
--
|
| 54 |
-- NumberInt is REQUIRED: NumberLong would break Gson doc parsing.
|
63 |
-- NumberInt is REQUIRED: NumberLong would break Gson doc parsing.
|
| 55 |
-- categorySpecs derivation for existing 10006/10007 docs is done via the
|
64 |
-- categorySpecs derivation for existing 10006/10007 docs is done via the
|
| 56 |
-- one-time endpoint POST /content/specs/derive?categoryId=... (see
|
65 |
-- one-time endpoint POST /content/specs/derive?categoryId=... (see
|
| 57 |
-- CategorySpecDerivationService).
|
66 |
-- CategorySpecDerivationService).
|
| 58 |
|
67 |
|