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
@@ -139,9 +139,10 @@ export const POST = withAdmin(
|
||||
}
|
||||
|
||||
// Post-import consolidation, mirroring the furni batch route:
|
||||
// keep offer_id / FurnitureData offerid in sync with the new local
|
||||
// sprite ids, verify interaction_modes_count, and refresh the
|
||||
// emulator + asset ownership. Never fails the stream — best effort.
|
||||
// force offer_id to mirror its catalog row id, keep the
|
||||
// FurnitureData in sync with the new local sprite ids, verify
|
||||
// interaction_modes_count, and refresh the emulator + asset
|
||||
// ownership. Never fails the stream — best effort.
|
||||
try {
|
||||
await reconcileImportedOfferIds();
|
||||
await reconcileFurniDataWithItemsBase();
|
||||
|
||||
@@ -272,7 +272,7 @@ export const POST = withAdmin(
|
||||
// Verify the furnidata matches the DB ids
|
||||
const furniReconcile = await reconcileFurniDataWithItemsBase();
|
||||
|
||||
// Rebuild every catalog offer_id from the furnidata
|
||||
// Force every catalog offer_id to equal its own row id
|
||||
const offerRebuild = await rebuildCatalogOfferIds();
|
||||
|
||||
// Repair any sprite_id drift so the client renders the right item
|
||||
|
||||
@@ -222,7 +222,7 @@ export const POST = withAdmin(
|
||||
}
|
||||
}
|
||||
|
||||
// Reconcile offer_id and fix asset ownership across the whole tree
|
||||
// Force offer_id to its row id and fix asset ownership across the tree
|
||||
let offerIdsFixed = 0;
|
||||
let ownershipFixed: string[] = [];
|
||||
let nitrosSynced: string[] = [];
|
||||
|
||||
@@ -501,7 +501,7 @@ export const POST = withAdmin(
|
||||
);
|
||||
}
|
||||
|
||||
// Reconcile offer_id with the furnidata sprite id across the tree
|
||||
// Force offer_id to mirror its catalog row id across the tree
|
||||
const reconciled = await reconcileImportedOfferIds();
|
||||
|
||||
// Keep asset + furnidata folders readable by the web server
|
||||
@@ -513,7 +513,7 @@ export const POST = withAdmin(
|
||||
// Verify the furnidata matches the DB ids
|
||||
const furniReconcile = await reconcileFurniDataWithItemsBase();
|
||||
|
||||
// Rebuild every catalog offer_id from the furnidata
|
||||
// Force every catalog offer_id to equal its own row id
|
||||
const offerRebuild = await rebuildCatalogOfferIds();
|
||||
|
||||
// Repair any sprite_id drift so the client renders the right item
|
||||
@@ -612,7 +612,7 @@ export const POST = withAdmin(
|
||||
result.warnings.push("RCON cache refresh failed");
|
||||
}
|
||||
|
||||
// Reconcile offer_id with the furnidata sprite id across the tree
|
||||
// Force offer_id to mirror its catalog row id across the tree
|
||||
const reconciled = await reconcileImportedOfferIds();
|
||||
|
||||
// Keep asset + furnidata folders readable by the web server
|
||||
@@ -628,7 +628,7 @@ export const POST = withAdmin(
|
||||
const { catalogNameFixed, haveOfferFixed, costCreditsFixed } =
|
||||
await fixDatabaseConsistencyAfterImport();
|
||||
|
||||
// Rebuild every catalog offer_id from the furnidata
|
||||
// Force every catalog offer_id to equal its own row id
|
||||
const offerRebuild = await rebuildCatalogOfferIds();
|
||||
|
||||
// Repair any sprite_id drift so the client renders the right item
|
||||
|
||||
Reference in new issue
Block a user