mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-28 16:15:57 -05:00
Check database version first, if that fails, try DB init
Doing it the other way around is a guaranteed way to run into issues when a schema upgrade is needed.
This commit is contained in:
parent
87abc3f432
commit
944bf3f132
12
src/db.c
12
src/db.c
@ -3140,6 +3140,11 @@ db_init(void)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = db_check_version();
|
||||
if (ret < 0)
|
||||
{
|
||||
DPRINTF(E_FATAL, L_DB, "Could not check database version, trying DB init\n");
|
||||
|
||||
ret = db_create_tables();
|
||||
if (ret < 0)
|
||||
{
|
||||
@ -3147,13 +3152,6 @@ db_init(void)
|
||||
db_perthread_deinit();
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = db_check_version();
|
||||
if (ret < 0)
|
||||
{
|
||||
DPRINTF(E_FATAL, L_DB, "Could not check database version\n");
|
||||
db_perthread_deinit();
|
||||
return -1;
|
||||
}
|
||||
|
||||
files = db_files_get_count();
|
||||
|
Loading…
Reference in New Issue
Block a user