mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-06-30 18:11:52 +02:00
Make migration management more robust
This commit is contained in:
+7
-8
@@ -170,14 +170,13 @@ class Database {
|
||||
throw new Error('Database connection failed')
|
||||
}
|
||||
|
||||
if (!this.isNew) {
|
||||
try {
|
||||
const migrationManager = new MigrationManager(this.sequelize, global.ConfigPath)
|
||||
await migrationManager.runMigrations(packageJson.version)
|
||||
} catch (error) {
|
||||
Logger.error(`[Database] Failed to run migrations`, error)
|
||||
throw new Error('Database migration failed')
|
||||
}
|
||||
try {
|
||||
const migrationManager = new MigrationManager(this.sequelize, global.ConfigPath)
|
||||
await migrationManager.init(packageJson.version)
|
||||
if (!this.isNew) await migrationManager.runMigrations()
|
||||
} catch (error) {
|
||||
Logger.error(`[Database] Failed to run migrations`, error)
|
||||
throw new Error('Database migration failed')
|
||||
}
|
||||
|
||||
await this.buildModels(force)
|
||||
|
||||
Reference in New Issue
Block a user