mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-02 01:05:25 +02:00
Fix previous version check for db migration to v2
This commit is contained in:
parent
9b8f53caf6
commit
68cf748e77
2 changed files with 20 additions and 1 deletions
14
server/Db.js
14
server/Db.js
|
@ -109,6 +109,20 @@ class Db {
|
|||
return this.init()
|
||||
}
|
||||
|
||||
// Get previous server version before loading DB to check whether a db migration is required
|
||||
// returns null if server was not upgraded
|
||||
checkPreviousVersion() {
|
||||
return this.settingsDb.select(() => true).then((results) => {
|
||||
if (results.data && results.data.length) {
|
||||
var serverSettings = results.data.find(s => s.id === 'server-settings')
|
||||
if (serverSettings && serverSettings.version && serverSettings.version !== version) {
|
||||
return serverSettings.version
|
||||
}
|
||||
}
|
||||
return null
|
||||
})
|
||||
}
|
||||
|
||||
async init() {
|
||||
await this.load()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue