[Bug]: Migration can crash if migrationsMeta
table exists but is empty
#3588
Labels
bug
Something isn't working
migrationsMeta
table exists but is empty
#3588
What happened?
A user in Discord reported a crash when upgrading from server version
2.12.3
to2.16.2
. Upon request, they tried upgrading to a few different versions, including2.13.3
and2.14.0
. They were able to upgrade to all versions before2.14.0
, but the migration failed and crashed for all servers version at2.14.0
and above.The user provided their database to me and I was able to reproduce the crash. Upon investigation, it looks like they somehow got an empty
migrationsMeta
table. I am not sure if this is a result of the failed upgrade to2.16.2
or something else.What did you expect to happen?
Migration to be handled when the table is empty. It appears to be a problem with how
isDatabaseNew
is handled. Instead of only checking if the table exists, we should also check that theversion
row exists.audiobookshelf/server/managers/MigrationManager.js
Lines 190 to 217 in 0c244cb
Steps to reproduce the issue
migrationsMeta
table in an existing database with no rows2.14.0
Audiobookshelf version
v2.16.2
How are you running audiobookshelf?
Built from source
What OS is your Audiobookshelf server hosted from?
Linux
If the issue is being seen in the UI, what browsers are you seeing the problem on?
None
Logs
Additional Notes
No response
The text was updated successfully, but these errors were encountered: