refactor: switch Drizzle ORM from postgres-js to bun-sql driver.

This commit is contained in:
syntaxbullet
2026-01-06 18:52:25 +01:00
parent a9d5c806ad
commit 2e6bdec38c

View File

@@ -1,14 +1,13 @@
import { drizzle } from "drizzle-orm/postgres-js"; import { drizzle } from "drizzle-orm/bun-sql";
import postgres from "postgres"; import { SQL } from "bun";
import * as schema from "@db/schema"; import * as schema from "@db/schema";
import { env } from "@lib/env"; import { env } from "@lib/env";
const connectionString = env.DATABASE_URL; const connectionString = env.DATABASE_URL;
// Disable prefetch as it is not supported by "transaction" method export const postgres = new SQL(connectionString);
export const client = postgres(connectionString, { prepare: false });
export const DrizzleClient = drizzle(client, { schema }); export const DrizzleClient = drizzle(postgres, { schema });
export const closeDatabase = async () => { export const closeDatabase = async () => {
await client.end(); await postgres.close();
}; };