mirror of
https://github.com/ArthurDanjou/arthome.git
synced 2026-01-14 20:19:26 +01:00
Migrate from postgres to sqlite
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(useDrizzle(), { 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