diff --git a/instrumentation.ts b/instrumentation.ts index 104e02d..ff615de 100644 --- a/instrumentation.ts +++ b/instrumentation.ts @@ -1,5 +1,10 @@ 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' })