Initial API scaffold: Elysia + Bun + Drizzle + BetterAuth + LangChain
This commit is contained in:
16
src/db/index.ts
Normal file
16
src/db/index.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { drizzle } from 'drizzle-orm/postgres-js';
|
||||
import postgres from 'postgres';
|
||||
import * as schema from './schema';
|
||||
|
||||
const connectionString = process.env.DATABASE_URL!;
|
||||
|
||||
if (!connectionString) {
|
||||
throw new Error('DATABASE_URL environment variable is required');
|
||||
}
|
||||
|
||||
// For query purposes
|
||||
const queryClient = postgres(connectionString);
|
||||
export const db = drizzle(queryClient, { schema });
|
||||
|
||||
// For migrations (uses a different client)
|
||||
export const migrationClient = postgres(connectionString, { max: 1 });
|
||||
Reference in New Issue
Block a user