Fix previous version check for db migration to v2

This commit is contained in:
advplyr
2022-04-20 08:31:57 -05:00
parent 9b8f53caf6
commit 68cf748e77
2 changed files with 20 additions and 1 deletions

View File

@@ -117,7 +117,12 @@ class Server {
await this.playbackSessionManager.removeOrphanStreams()
await this.downloadManager.removeOrphanDownloads()
if (version.localeCompare('2.0.0') <= 0) { // Old version data model migration
var previousVersion = await this.db.checkPreviousVersion() // Returns null if same server version
if (previousVersion) {
Logger.debug(`[Server] Upgraded from previous version ${previousVersion}`)
}
if (previousVersion && previousVersion.localeCompare('2.0.0') < 0) { // Old version data model migration
Logger.debug(`[Server] Previous version was < 2.0.0 - migration required`)
await dbMigration.migrate(this.db)
} else {
await this.db.init()