boring.tools-poc/packages/database/src/index.ts
Lars Hampe c31900d94a
All checks were successful
Build and Push Docker Image / tests (push) Successful in 50s
Build and Push Docker Image / build (push) Successful in 55s
feat(api): database migrations on startup
2024-10-01 20:39:12 +02:00

14 lines
388 B
TypeScript

import { drizzle } from 'drizzle-orm/node-postgres'
import { Client } from 'pg'
export * from './migration'
import * as schema from './schema'
export * from './schema'
const POSTGRES_URL = import.meta.env.POSTGRES_URL ?? process.env.POSTGRES_URL
export const client = new Client({ connectionString: POSTGRES_URL })
await client.connect()
export const db = drizzle(client, { schema })