import { drizzle } from "drizzle-orm/bun-sql";
import { SQL } from "bun";
import * as schema from "@db/schema";
import { env } from "@lib/env";

const connectionString = env.DATABASE_URL;
export const postgres = new SQL(connectionString);

export const DrizzleClient = drizzle(postgres, { schema });

export const closeDatabase = async () => {
    await postgres.close();
};