/** * v0.11.0 Plant-type backfill. Seeds the PlantType library from the built-in * plant DB and links existing plantings to their kind. Idempotent — runs on * deploy (docker-entrypoint.sh) and can be run manually: * * npx tsx prisma/scripts/backfill-plant-types.ts */ import { PrismaClient } from "@prisma/client"; import { syncPlantTypesFromLibrary } from "../../src/lib/garden/plant-types"; const db = new PrismaClient(); async function main() { const r = await syncPlantTypesFromLibrary(db); console.log(`Plant types: library has ${r.types} kinds; linked ${r.linked} planting(s).`); } main() .catch((e) => { console.error("Plant-type backfill failed:", e); process.exit(1); }) .finally(() => db.$disconnect());