fixing migration issues
This commit is contained in:
@@ -1,5 +1,10 @@
|
|||||||
export async function register() {
|
export async function register() {
|
||||||
if (process.env.NEXT_RUNTIME === 'nodejs') {
|
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 { migrate } = await import('drizzle-orm/postgres-js/migrator')
|
||||||
const { db } = await import('@/lib/db')
|
const { db } = await import('@/lib/db')
|
||||||
await migrate(db, { migrationsFolder: './lib/db/migrations' })
|
await migrate(db, { migrationsFolder: './lib/db/migrations' })
|
||||||
|
|||||||
Reference in New Issue
Block a user