Spaces:
Configuration error
Configuration error
| import { Pool } from 'pg' | |
| import { PrismaPg } from '@prisma/adapter-pg' | |
| import { PrismaClient } from '@prisma/client' | |
| import 'dotenv/config' | |
| const connectionString = process.env.DATABASE_URL | |
| if (!connectionString) throw new Error('DATABASE_URL not set') | |
| const pool = new Pool({ connectionString }) | |
| const adapter = new PrismaPg(pool) | |
| const prisma = new PrismaClient({ adapter }) | |
| async function updateToGemini() { | |
| console.log('π Updating all prompts to use Gemini 2.5 Flash as default...\n') | |
| const result = await prisma.prompt.updateMany({ | |
| data: { | |
| modelDefault: 'gemini-2.5-flash', | |
| modelAllowed: ['gemini-2.5-flash', 'gemini-2.0-flash', 'gpt-4o-mini', 'gpt-4o', 'claude-3-5-sonnet'], | |
| }, | |
| }) | |
| console.log(`β Updated ${result.count} prompts to use Gemini 2.5 Flash!`) | |
| } | |
| updateToGemini() | |
| .catch((e) => { | |
| console.error('β Update failed:', e) | |
| process.exit(1) | |
| }) | |
| .finally(async () => { | |
| await prisma.$disconnect() | |
| await pool.end() | |
| }) | |