[db] Upgrade schema to 19.10 to remove invalid time_skipped values from commit fde0a281

This commit is contained in:
ejurgensen 2018-09-19 19:40:45 +02:00
parent a003c419c3
commit f686756dd8
2 changed files with 21 additions and 1 deletions

View File

@ -26,7 +26,7 @@
* is a major upgrade. In other words minor version upgrades permit downgrading * is a major upgrade. In other words minor version upgrades permit downgrading
* forked-daapd after the database was upgraded. */ * forked-daapd after the database was upgraded. */
#define SCHEMA_VERSION_MAJOR 19 #define SCHEMA_VERSION_MAJOR 19
#define SCHEMA_VERSION_MINOR 9 #define SCHEMA_VERSION_MINOR 10
int int
db_init_indices(sqlite3 *hdl); db_init_indices(sqlite3 *hdl);

View File

@ -1667,6 +1667,20 @@ static const struct db_upgrade_query db_upgrade_v1909_queries[] =
{ U_V1909_SCVER_MINOR, "set schema_version_minor to 09" }, { U_V1909_SCVER_MINOR, "set schema_version_minor to 09" },
}; };
// Clean up after bug in commit fde0a281 (schema 19.09)
#define U_V1910_CLEANUP_TIME_SKIPPED \
"UPDATE files SET time_skipped = 0 WHERE time_skipped > 2000000000;"
#define U_V1910_SCVER_MINOR \
"UPDATE admin SET value = '10' WHERE key = 'schema_version_minor';"
static const struct db_upgrade_query db_upgrade_v1910_queries[] =
{
{ U_V1910_CLEANUP_TIME_SKIPPED, "clean up time_skipped" },
{ U_V1910_SCVER_MINOR, "set schema_version_minor to 10" },
};
int int
db_upgrade(sqlite3 *hdl, int db_ver) db_upgrade(sqlite3 *hdl, int db_ver)
@ -1841,6 +1855,12 @@ db_upgrade(sqlite3 *hdl, int db_ver)
if (ret < 0) if (ret < 0)
return -1; return -1;
/* FALLTHROUGH */
case 1909:
ret = db_generic_upgrade(hdl, db_upgrade_v1910_queries, ARRAY_SIZE(db_upgrade_v1910_queries));
if (ret < 0)
return -1;
break; break;
default: default: