feat: Add a script to simulate CI locally by setting up a temporary PostgreSQL database, running tests, and updating dependencies.

This commit is contained in:
syntaxbullet
2026-01-30 16:30:26 +01:00
parent bb823c86c1
commit aac9be19f2
4 changed files with 130 additions and 26 deletions

View File

@@ -1,13 +1,18 @@
import { drizzle } from "drizzle-orm/bun-sql";
import { SQL } from "bun";
import { drizzle } from "drizzle-orm/postgres-js";
import postgresJs from "postgres"; // Renamed import
import * as schema from "./schema";
import { env } from "@shared/lib/env";
const connectionString = env.DATABASE_URL;
export const postgres = new SQL(connectionString);
export const DrizzleClient = drizzle(postgres, { schema });
// Disable prefetch to prevent connection handling issues in serverless/container environments
const client = postgresJs(connectionString, { prepare: false });
export const DrizzleClient = drizzle(client, { schema });
// Export the raw client as 'postgres' to match previous Bun.SQL export name/usage
export const postgres = client;
export const closeDatabase = async () => {
await postgres.close();
await client.end();
};