mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-08 22:48:14 -05:00
* feat(billing): bill by threshold to prevent cancellation edge case * fix org billing * fix idempotency key issue * small optimization for team checks * remove console log * remove unused type * fix error handling
21 lines
490 B
TypeScript
21 lines
490 B
TypeScript
import { drizzle } from 'drizzle-orm/postgres-js'
|
|
import postgres from 'postgres'
|
|
import * as schema from './schema'
|
|
|
|
export * from './schema'
|
|
|
|
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: 30,
|
|
onnotice: () => {},
|
|
})
|
|
|
|
export const db = drizzle(postgresClient, { schema })
|