mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
fix: use postgres_url provided by supabase/vercel config instead of database_url
This commit is contained in:
+7
-2
@@ -1,8 +1,13 @@
|
||||
import { drizzle } from 'drizzle-orm/postgres-js'
|
||||
import postgres from 'postgres'
|
||||
|
||||
const connectionString = process.env.DATABASE_URL!
|
||||
// In production, use the Vercel-generated POSTGRES_URL
|
||||
// In development, use the direct DATABASE_URL
|
||||
const connectionString = process.env.POSTGRES_URL || process.env.DATABASE_URL!
|
||||
|
||||
// Disable prefetch as it is not supported for "Transaction" pool mode
|
||||
const client = postgres(connectionString, { prepare: false })
|
||||
const client = postgres(connectionString, {
|
||||
prepare: false,
|
||||
ssl: process.env.NODE_ENV === 'production',
|
||||
})
|
||||
export const db = drizzle(client)
|
||||
|
||||
Reference in New Issue
Block a user