summaryrefslogtreecommitdiff
path: root/packages/db/src/index.ts
blob: b712776c92991ff47d47713fd8e1066d162278a2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";
import * as schema from "./schema";

if (!process.env.DATABASE_URL) {
  throw new Error("DATABASE_URL is not set");
}

// Create the postgres client
const client = postgres(process.env.DATABASE_URL);

// Create the drizzle instance
export const db = drizzle(client, { schema });

// Re-export schema for convenience
export * from "./schema";