feat: Migrate Drizzle ORM to postgres.js, exclude test files from command loading, and adjust postgres dependency type.
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
import { drizzle } from "drizzle-orm/bun-sql";
|
||||
import { SQL } from "bun";
|
||||
import { drizzle } from "drizzle-orm/postgres-js";
|
||||
import postgres from "postgres";
|
||||
import * as schema from "@db/schema";
|
||||
import { env } from "@lib/env";
|
||||
|
||||
const connectionString = env.DATABASE_URL;
|
||||
export const postgres = new SQL(connectionString);
|
||||
// Disable prefetch as it is not supported by "transaction" method
|
||||
export const client = postgres(connectionString, { prepare: false });
|
||||
|
||||
export const DrizzleClient = drizzle(postgres, { schema });
|
||||
export const DrizzleClient = drizzle(client, { schema });
|
||||
|
||||
export const closeDatabase = async () => {
|
||||
await postgres.close();
|
||||
await client.end();
|
||||
};
|
||||
@@ -40,7 +40,7 @@ export class CommandLoader {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!file.name.endsWith('.ts') && !file.name.endsWith('.js')) continue;
|
||||
if ((!file.name.endsWith('.ts') && !file.name.endsWith('.js')) || file.name.endsWith('.test.ts') || file.name.endsWith('.spec.ts')) continue;
|
||||
|
||||
await this.loadCommandFile(filePath, reload, result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user