mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
22 lines
517 B
TypeScript
22 lines
517 B
TypeScript
import { drizzle } from 'drizzle-orm/postgres-js'
|
|
import postgres from 'postgres'
|
|
import * as schema from './schema'
|
|
|
|
export * from './schema'
|
|
export * from './triggers'
|
|
|
|
const connectionString = process.env.DATABASE_URL!
|
|
if (!connectionString) {
|
|
throw new Error('Missing DATABASE_URL environment variable')
|
|
}
|
|
|
|
const postgresClient = postgres(connectionString, {
|
|
prepare: false,
|
|
idle_timeout: 20,
|
|
connect_timeout: 30,
|
|
max: 10,
|
|
onnotice: () => {},
|
|
})
|
|
|
|
export const db = drizzle(postgresClient, { schema })
|