feat: PostgreSQL support en Vercel CI/CD deployment

- Prisma schema: sqlite → postgresql provider met directUrl
- prisma.config.ts: directUrl toegevoegd
- seed.ts: dynamisch SQLite of PostgreSQL adapter op basis van DATABASE_URL
- ci.yml: preview deploy op PR, productie deploy op push naar main

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Janpeter Visser 2026-04-24 12:59:12 +02:00
parent d11b114fc1
commit 08de004ae7
4 changed files with 82 additions and 10 deletions

View file

@ -1,5 +1,4 @@
import { PrismaClient } from '@prisma/client'
import { PrismaBetterSqlite3 } from '@prisma/adapter-better-sqlite3'
import * as dotenv from 'dotenv'
import * as path from 'path'
import * as bcrypt from 'bcryptjs'
@ -15,9 +14,19 @@ async function main() {
const url = process.env.DATABASE_URL
if (!url) throw new Error('DATABASE_URL is not set. Check .env.local')
// For SQLite: adapter takes a config object with url
const adapter = new PrismaBetterSqlite3({ url })
prisma = new PrismaClient({ adapter })
if (url.startsWith('file:')) {
// SQLite (local development)
const { PrismaBetterSqlite3 } = await import('@prisma/adapter-better-sqlite3')
const adapter = new PrismaBetterSqlite3({ url })
prisma = new PrismaClient({ adapter })
} else {
// PostgreSQL (Neon / production)
const { Pool } = await import('pg')
const { PrismaPg } = await import('@prisma/adapter-pg')
const pool = new Pool({ connectionString: url })
const adapter = new PrismaPg(pool)
prisma = new PrismaClient({ adapter })
}
console.log('Seeding database...')