mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-27 23:55: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
20
src/db.c
20
src/db.c
@ -3140,20 +3140,18 @@ db_init(void)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = db_create_tables();
|
||||
if (ret < 0)
|
||||
{
|
||||
DPRINTF(E_FATAL, L_DB, "Could not create tables\n");
|
||||
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;
|
||||
DPRINTF(E_FATAL, L_DB, "Could not check database version, trying DB init\n");
|
||||
|
||||
ret = db_create_tables();
|
||||
if (ret < 0)
|
||||
{
|
||||
DPRINTF(E_FATAL, L_DB, "Could not create tables\n");
|
||||
db_perthread_deinit();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
files = db_files_get_count();
|
||||
|
Loading…
Reference in New Issue
Block a user