Spaces:
Paused
Paused
| import { drizzle } from 'drizzle-orm/neon-http'; | |
| import { neon } from '@neondatabase/serverless'; | |
| import * as schema from './schema'; | |
| // CRITICAL FIX: Use a fallback connection string if DATABASE_URL is missing. | |
| // This prevents the build from failing on Hugging Face (or other CI) during the "Collecting page data" phase. | |
| // We removed the explicit "if (!process.env.DATABASE_URL) throw Error" check. | |
| const connectionString = process.env.DATABASE_URL || 'postgres://fallback_user:fallback_pass@localhost:5432/fallback_db'; | |
| const sql = neon(connectionString); | |
| export const db = drizzle(sql, { schema }); | |
| export { schema }; |