Merge pull request #3418 from mikiher/fix-database-version-init

Fix MigrationManager initial run behavior
This commit is contained in:
advplyr 2024-09-14 10:09:46 -05:00 committed by GitHub
commit 8493e56b11
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 87 additions and 17 deletions

View file

@ -176,9 +176,9 @@ class Database {
}
try {
const migrationManager = new MigrationManager(this.sequelize, global.ConfigPath)
const migrationManager = new MigrationManager(this.sequelize, this.isNew, global.ConfigPath)
await migrationManager.init(packageJson.version)
if (!this.isNew) await migrationManager.runMigrations()
await migrationManager.runMigrations()
} catch (error) {
Logger.error(`[Database] Failed to run migrations`, error)
throw new Error('Database migration failed')