mirror of
https://github.com/ArthurDanjou/arthome.git
synced 2026-01-14 12:14:33 +01:00
18 lines
453 B
TypeScript
18 lines
453 B
TypeScript
import { consola } from 'consola'
|
|
import { migrate } from 'drizzle-orm/d1/migrator'
|
|
|
|
export default defineNitroPlugin(async () => {
|
|
if (!import.meta.dev)
|
|
return
|
|
|
|
onHubReady(async () => {
|
|
await migrate(useDB(), { migrationsFolder: 'server/database/migrations' })
|
|
.then(() => {
|
|
consola.success('Database migrations done')
|
|
})
|
|
.catch((err) => {
|
|
consola.error('Database migrations failed', err)
|
|
})
|
|
})
|
|
})
|