import 'dotenv/config'; import pg from 'pg'; import { PrismaPg } from '@prisma/adapter-pg'; import { PrismaClient } from '../src/lib/generated/prisma/client'; const pool = new pg.Pool({ connectionString: process.env.DATABASE_URL }); const prisma = new PrismaClient({ adapter: new PrismaPg(pool) }); // A handful of real Proclamations so schedule Blocks have valid references. async function main() { const category = await prisma.proclamationCategory.findFirst({ orderBy: { id: 'asc' } }); const group = await prisma.proclamationGroup.findFirst({ orderBy: { id: 'asc' } }); const freq = await prisma.solfeggioFrequency.findFirst({ orderBy: { id: 'asc' } }); if (!category || !group || !freq) throw new Error('seed missing catalog'); const names = ['P5 Dawn', 'P5 Dusk', 'P5 Noon', 'P5 Night']; const ids: string[] = []; for (const name of names) { const existing = await prisma.proclamation.findUnique({ where: { name } }); if (existing) { ids.push(existing.id); continue; } const created = await prisma.proclamation.create({ data: { name, content: `

${name} content

`, categoryId: category.id, groupId: group.id, solfeggioFrequencyId: freq.id } }); ids.push(created.id); } console.log(JSON.stringify(ids)); await prisma.$disconnect(); await pool.end(); } main().catch(async (e) => { console.error(e); await prisma.$disconnect(); await pool.end(); process.exit(1); });