mirror of
https://github.com/ArthurDanjou/spanish-learner.git
synced 2026-01-14 12:14:39 +01:00
Initial commit
This commit is contained in:
17
server/plugins/migrations.ts
Normal file
17
server/plugins/migrations.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
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)
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user