mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-25 06:35:57 -05:00
Fix db upgrade from 12 -> 13
This commit is contained in:
parent
4d8e618f75
commit
d5506fc46f
@ -65,7 +65,7 @@
|
|||||||
<short_description>
|
<short_description>
|
||||||
Should the logfile get truncated on startup?
|
Should the logfile get truncated on startup?
|
||||||
</short_description>
|
</short_description>
|
||||||
<type default_value="1">select</type>
|
<type default_value="0">select</type>
|
||||||
<options>
|
<options>
|
||||||
<option value="0">No</option>
|
<option value="0">No</option>
|
||||||
<option value="1">Yes</option>
|
<option value="1">Yes</option>
|
||||||
|
@ -126,6 +126,7 @@ static CONF_ELEMENTS conf_elements[] = {
|
|||||||
{ 0, 0, CONF_T_STRING,"general","never_transcode" },
|
{ 0, 0, CONF_T_STRING,"general","never_transcode" },
|
||||||
{ 0, 0, CONF_T_MULTICOMMA,"general","compdirs" },
|
{ 0, 0, CONF_T_MULTICOMMA,"general","compdirs" },
|
||||||
{ 0, 0, CONF_T_STRING,"general","logfile" },
|
{ 0, 0, CONF_T_STRING,"general","logfile" },
|
||||||
|
{ 0, 0, CONF_T_INT,"general","truncate" },
|
||||||
{ 0, 0, CONF_T_EXISTPATH,"plugins","plugin_dir" },
|
{ 0, 0, CONF_T_EXISTPATH,"plugins","plugin_dir" },
|
||||||
{ 0, 0, CONF_T_MULTICOMMA,"plugins","plugins" },
|
{ 0, 0, CONF_T_MULTICOMMA,"plugins","plugins" },
|
||||||
{ 0, 0, CONF_T_INT,"daap","empty_strings" },
|
{ 0, 0, CONF_T_INT,"daap","empty_strings" },
|
||||||
|
@ -69,7 +69,7 @@ static char *db_sqlite2_enum_query;
|
|||||||
|
|
||||||
static char db_sqlite2_path[PATH_MAX + 1];
|
static char db_sqlite2_path[PATH_MAX + 1];
|
||||||
|
|
||||||
#define DB_SQLITE2_VERSION 12
|
#define DB_SQLITE2_VERSION 13
|
||||||
|
|
||||||
|
|
||||||
/* Forwards */
|
/* Forwards */
|
||||||
@ -157,7 +157,8 @@ int db_sqlite2_open(char **pe, char *dsn) {
|
|||||||
DPRINTF(E_LOG,L_DB,"Can't get db version. New database?\n");
|
DPRINTF(E_LOG,L_DB,"Can't get db version. New database?\n");
|
||||||
} else if(ver != DB_SQLITE2_VERSION) {
|
} else if(ver != DB_SQLITE2_VERSION) {
|
||||||
/* we'll deal with this in the db handler */
|
/* we'll deal with this in the db handler */
|
||||||
DPRINTF(E_LOG,L_DB,"Old database version.\n");
|
DPRINTF(E_LOG,L_DB,"Old database version: %d, expecting %d\n",
|
||||||
|
ver, DB_SQLITE2_VERSION);
|
||||||
db_get_error(pe,DB_E_WRONGVERSION);
|
db_get_error(pe,DB_E_WRONGVERSION);
|
||||||
return DB_E_WRONGVERSION;
|
return DB_E_WRONGVERSION;
|
||||||
}
|
}
|
||||||
@ -328,13 +329,13 @@ int db_sqlite2_event(int event_type) {
|
|||||||
if(!conf_get_int("database","quick_startup",0))
|
if(!conf_get_int("database","quick_startup",0))
|
||||||
db_sqlite2_exec(NULL,E_FATAL,"vacuum");
|
db_sqlite2_exec(NULL,E_FATAL,"vacuum");
|
||||||
|
|
||||||
/* make sure our indexes exist */
|
/* make sure our indexes exist */
|
||||||
db_sqlite2_exec(NULL,E_DBG,"create index idx_path on "
|
db_sqlite2_exec(NULL,E_DBG,"create index idx_path on "
|
||||||
"songs(path,idx)");
|
"songs(path,idx)");
|
||||||
db_sqlite2_exec(NULL,E_DBG,"create index idx_songid on "
|
db_sqlite2_exec(NULL,E_DBG,"create index idx_songid on "
|
||||||
"playlistitems(songid)");
|
"playlistitems(songid)");
|
||||||
db_sqlite2_exec(NULL,E_DBG,"create index idx_playlistid on "
|
db_sqlite2_exec(NULL,E_DBG,"create index idx_playlistid on "
|
||||||
"playlistitems(playlistid,songid)");
|
"playlistitems(playlistid,songid)");
|
||||||
|
|
||||||
db_sqlite2_reload=0;
|
db_sqlite2_reload=0;
|
||||||
break;
|
break;
|
||||||
|
@ -152,7 +152,8 @@ int db_sqlite3_open(char **pe, char *dsn) {
|
|||||||
/* we'll catch this on the init */
|
/* we'll catch this on the init */
|
||||||
DPRINTF(E_LOG,L_DB,"Can't get db version. New database?\n");
|
DPRINTF(E_LOG,L_DB,"Can't get db version. New database?\n");
|
||||||
} else if(ver != DB_SQLITE3_VERSION) {
|
} else if(ver != DB_SQLITE3_VERSION) {
|
||||||
DPRINTF(E_LOG,L_DB,"Old database version.\n");
|
DPRINTF(E_LOG,L_DB,"Old database version: %d, expecting %d\n",
|
||||||
|
ver,DB_SQLITE3_VERSION);
|
||||||
db_get_error(pe,DB_E_WRONGVERSION);
|
db_get_error(pe,DB_E_WRONGVERSION);
|
||||||
return DB_E_WRONGVERSION;
|
return DB_E_WRONGVERSION;
|
||||||
}
|
}
|
||||||
@ -362,12 +363,12 @@ int db_sqlite3_event(int event_type) {
|
|||||||
if(!conf_get_int("database","quick_startup",0))
|
if(!conf_get_int("database","quick_startup",0))
|
||||||
db_sqlite3_exec(NULL,E_FATAL,"vacuum");
|
db_sqlite3_exec(NULL,E_FATAL,"vacuum");
|
||||||
|
|
||||||
db_sqlite3_exec(NULL,E_DBG,"create index idx_path on "
|
db_sqlite3_exec(NULL,E_DBG,"create index idx_path on "
|
||||||
"songs(path,idx)");
|
"songs(path,idx)");
|
||||||
db_sqlite3_exec(NULL,E_DBG,"create index idx_songid on "
|
db_sqlite3_exec(NULL,E_DBG,"create index idx_songid on "
|
||||||
"playlistitems(songid)");
|
"playlistitems(songid)");
|
||||||
db_sqlite3_exec(NULL,E_DBG,"create index idx_playlistid on "
|
db_sqlite3_exec(NULL,E_DBG,"create index idx_playlistid on "
|
||||||
"playlistitems(playlistid,songid)");
|
"playlistitems(playlistid,songid)");
|
||||||
db_sqlite3_reload=0;
|
db_sqlite3_reload=0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user