import "./_env"; import { getAdminPocketBase } from "../src/lib/server/pocketbase-admin"; async function main() { const pb = await getAdminPocketBase(); const rows = await pb.collection("stock_items").getList(1, 3, { filter: 'location = "NSS Fasteners price list - hex nut DIN934 (Grade 8 + A2)"', sort: "sku", }); console.log("Sample rows after fix:\n"); for (const r of rows.items) { console.log("SKU: " + r.sku); console.log("name: " + JSON.stringify(r.name)); console.log("description:" + JSON.stringify(r.description)); console.log("notes: " + JSON.stringify(r.notes?.substring(0, 120) + (r.notes && r.notes.length > 120 ? "…" : ""))); console.log("name == description? " + (r.name === r.description ? "✓" : "✗")); console.log(""); } // Tally: how many rows now have name == description? const allRows = await pb.collection("stock_items").getFullList<{ name: string; description: string }>({ filter: 'location = "NSS Fasteners price list - hex nut DIN934 (Grade 8 + A2)"', fields: "name,description", batch: 200, }); const matching = allRows.filter((r) => r.name === r.description).length; console.log(`Rows with name == description: ${matching}/${allRows.length}`); } main().catch((e) => { console.error(e); process.exit(1); });