forked from syntaxbullet/AuroraBot-discord
refactor: switch Drizzle ORM from postgres-js to bun-sql driver.
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
import { drizzle } from "drizzle-orm/postgres-js";
|
||||
import postgres from "postgres";
|
||||
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;
|
||||
// Disable prefetch as it is not supported by "transaction" method
|
||||
export const client = postgres(connectionString, { prepare: false });
|
||||
export const postgres = new SQL(connectionString);
|
||||
|
||||
export const DrizzleClient = drizzle(client, { schema });
|
||||
export const DrizzleClient = drizzle(postgres, { schema });
|
||||
|
||||
export const closeDatabase = async () => {
|
||||
await client.end();
|
||||
await postgres.close();
|
||||
};
|
||||
Reference in New Issue
Block a user