2026-06-14 15:36:44 +02:00
|
|
|
import { drizzle } from 'drizzle-orm/postgres-js'
|
|
|
|
|
import postgres from 'postgres'
|
|
|
|
|
import * as schema from './schema'
|
|
|
|
|
|
2026-06-14 17:01:06 +02:00
|
|
|
// Passwords with special chars (#, ], =) must be percent-encoded in DATABASE_URL.
|
|
|
|
|
// postgres.js decodes them correctly (e.g. %23 → #). No separate DB_PASSWORD needed.
|
|
|
|
|
const client = postgres(
|
|
|
|
|
process.env.DATABASE_URL ?? 'postgres://wc:wc@localhost:5432/worldcup',
|
|
|
|
|
{ max: 10 }
|
|
|
|
|
)
|
2026-06-14 15:36:44 +02:00
|
|
|
export const db = drizzle(client, { schema })
|
|
|
|
|
|
|
|
|
|
export * from './schema'
|