This commit is contained in:
gpatruno
2026-07-18 16:26:08 +02:00
parent 49c444e8b9
commit 2614d679c8
85 changed files with 8074 additions and 710 deletions
+38
View File
@@ -0,0 +1,38 @@
/**
* Backfill existing InventoryItem rows with FT mid float + catalog marketValue.
* Run after: npx prisma db push
*
* npm run db:backfill-wear --prefix server
*/
import { prisma } from '../src/db.js';
import { FT_MID_FLOAT } from '../src/wear.js';
async function main() {
const rows = await prisma.inventoryItem.findMany({
include: { item: true },
});
let updated = 0;
for (const inv of rows) {
if (inv.valueCents !== 0) continue;
await prisma.inventoryItem.update({
where: { id: inv.id },
data: {
floatValue: FT_MID_FLOAT,
wear: 'Field-Tested',
paintSeed: 0,
valueCents: inv.item.marketValue,
},
});
updated += 1;
}
console.log(`Backfilled ${updated} / ${rows.length} inventory items`);
}
main()
.catch((err) => {
console.error(err);
process.exit(1);
})
.finally(() => prisma.$disconnect());