13 lines
470 B
TypeScript
13 lines
470 B
TypeScript
export async function register() {
|
|
if (process.env.NEXT_RUNTIME === 'nodejs') {
|
|
const fs = await import('fs')
|
|
const path = await import('path')
|
|
const journal = path.join(process.cwd(), 'lib/db/migrations/meta/_journal.json')
|
|
if (!fs.existsSync(journal)) return
|
|
|
|
const { migrate } = await import('drizzle-orm/postgres-js/migrator')
|
|
const { db } = await import('@/lib/db')
|
|
await migrate(db, { migrationsFolder: './lib/db/migrations' })
|
|
}
|
|
}
|