// OTM owner seed — runs at container start. Creates the owner ONLY when // SEED_OWNER_EMAIL/SEED_OWNER_PASSWORD_HASH are set AND the User table is // empty (the platform convention — see platform CLAUDE.md "Owner seed"). import { PrismaClient } from "@prisma/client"; const db = new PrismaClient(); const email = process.env.SEED_OWNER_EMAIL?.toLowerCase().trim(); const hash = process.env.SEED_OWNER_PASSWORD_HASH; if (!email || !hash) { console.log("seed-owner: SEED_OWNER_* not set — skipping"); } else if ((await db.user.count()) > 0) { console.log("seed-owner: users exist — skipping"); } else { await db.user.create({ data: { email, passwordHash: hash, role: "OWNER" } }); console.log(`seed-owner: created OWNER ${email}`); } await db.$disconnect();