|
@@ -5,9 +5,12 @@ import { drizzle } from 'drizzle-orm/postgres-js';
|
|
|
import postgres from 'postgres';
|
|
import postgres from 'postgres';
|
|
|
import * as schema from './schema';
|
|
import * as schema from './schema';
|
|
|
|
|
|
|
|
|
|
+// Ensure postgres is properly imported
|
|
|
|
|
+const postgresClient = postgres || require('postgres');
|
|
|
|
|
+
|
|
|
if (!process.env.DATABASE_URL) {
|
|
if (!process.env.DATABASE_URL) {
|
|
|
throw new Error('DATABASE_URL is not defined');
|
|
throw new Error('DATABASE_URL is not defined');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const client = postgres(process.env.DATABASE_URL);
|
|
|
|
|
|
|
+const client = postgresClient(process.env.DATABASE_URL);
|
|
|
export const db = drizzle(client, { schema });
|
|
export const db = drizzle(client, { schema });
|