#!/usr/bin/env tsx import { config } from 'dotenv'; import { Pool } from 'pg'; import { PrismaPg } from '@prisma/adapter-pg'; import { PrismaClient } from '@prisma/client'; import fs from 'fs/promises'; config({ path: '.env.local' }); async function main() { console.log('📦 Exporting Germany from Neon...'); const pool = new Pool({ connectionString: process.env.DATABASE_URL }); const adapter = new PrismaPg(pool); const prisma = new PrismaClient({ adapter }); await prisma.$connect(); const churches = await prisma.churches.findMany({ where: { country: 'DE' }, include: { massSchedules: true, confessionSchedules: true, adorationSchedules: true, } }); console.log(`Found ${churches.length} churches in Germany`); await fs.writeFile('export-DE.json', JSON.stringify(churches, null, 2)); console.log(`✅ Exported to export-DE.json`); await prisma.$disconnect(); await pool.end(); } main().catch(console.error);