import { openDb } from "../server/src/db.js"; import { loadConfig } from "../server/src/config.js"; const db = openDb(loadConfig().dbPath); const tables = (db.prepare("SELECT name FROM sqlite_master WHERE type='table'").all() as Array<{name:string}>).map(t=>t.name); console.log(tables.filter(t=>/fact|leg/i.test(t)).join(",")); for (const slug of ["oskar-lumo","oskar-tilia"]) { const p = db.prepare("SELECT id FROM products WHERE slug=?").get(slug) as {id:string}; console.log("===",slug,"==="); for (const r of db.prepare("SELECT key,value_json,status FROM product_facts WHERE product_id=? AND (key LIKE 'legs.%' OR key LIKE '%leg%')").all(p.id) as Array<{key:string;value_json:string;status:string}>) console.log(r.key, r.value_json, r.status); }