Force catalog_items.offer_id to always equal its own row id
Every write path now sets offer_id = catalog_items.id instead of the sprite id or furnidata offerid: single import insert/update, clone import, upload import (direct DB + generated SQL migration), catalog repair inserts, reconcileImportedOfferIds and rebuildCatalogOfferIds. rebuildCatalogOfferIds is reduced to one bulk UPDATE that repairs any drift across all rows after every import; 74.838 legacy rows were repaired on the live database with this change.
This commit is contained in:
1 parent
adb56eb80b
commit
5311ee1fb8
10 files changed
+45
-103
No files matched your search
@@ -408,10 +408,10 @@ export async function generateCatalogSql(
|
||||
const price = autoPriceFurni(entry.classname);
|
||||
// catalog_name must match items_base.item_name (the classname), exactly
|
||||
// like the app's own import pipeline, so the studio's in-catalog joins
|
||||
// and the emulator's item lookup stay consistent. offer_id is the item id
|
||||
// (sprite id), not a literal '-1'.
|
||||
// and the emulator's item lookup stay consistent. offer_id mirrors the
|
||||
// row's own id, never a literal '-1'.
|
||||
statements.push(
|
||||
`INSERT INTO catalog_items (id, page_id, item_ids, catalog_name, cost_credits, cost_points, points_type, amount, order_number, offer_id, extradata) VALUES (${nextId}, ${pageId}, ${entry.itemId}, '${escSqlLiteral(entry.classname)}', ${price.credits}, ${price.points}, ${price.pointsType}, 1, 1, ${entry.itemId}, '');`,
|
||||
`INSERT INTO catalog_items (id, page_id, item_ids, catalog_name, cost_credits, cost_points, points_type, amount, order_number, offer_id, extradata) VALUES (${nextId}, ${pageId}, ${entry.itemId}, '${escSqlLiteral(entry.classname)}', ${price.credits}, ${price.points}, ${price.pointsType}, 1, 1, ${nextId}, '');`,
|
||||
);
|
||||
nextId++;
|
||||
generated++;
|
||||
|
||||
Reference in new issue
Block a user