ConusAI vendor 81941888f
This commit is contained in:
+16
@@ -0,0 +1,16 @@
|
||||
// Applies the SQL migrations in drizzle/ before the app starts (plan D15).
|
||||
// `npm start` runs it first, so a deploy never serves against an old schema.
|
||||
import { drizzle } from 'drizzle-orm/postgres-js'
|
||||
import { migrate } from 'drizzle-orm/postgres-js/migrator'
|
||||
import postgres from 'postgres'
|
||||
|
||||
const url = process.env.POSTGRES_URL
|
||||
if (!url) {
|
||||
console.error('POSTGRES_URL is required to apply migrations')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const client = postgres(url, { max: 1 })
|
||||
await migrate(drizzle(client), { migrationsFolder: 'drizzle' })
|
||||
await client.end()
|
||||
console.log('migrations applied')
|
||||
Reference in New Issue
Block a user