v0.11.0 — Plant types: the reusable "kind" record
A rich-but-all-optional reference record per kind of plant (care, sun, water, bloom & harvest windows, toxic-to-pets, edible parts, spacing), distinct from a specific planting or a group. - PlantType model + optional Plant.plantTypeId; migration + idempotent backfill that seeds 247 kinds from the built-in plant library and links plantings by species/common name (wired into the deploy entrypoint) - /api/plant-types CRUD; new "Plant types" section (browse by category, edit a kind, see every spot you've planted it) - New plants auto-link to their type on create; plant detail shows "More about…" - PlantType added to backup/restore; bump APP_VERSION 0.11.0 + changelog Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
23
prisma/scripts/backfill-plant-types.ts
Normal file
23
prisma/scripts/backfill-plant-types.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* 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());
|
||||
Reference in New Issue
Block a user