Handle database upgrade v9 -> v10

This commit is contained in:
Julien BLACHE 2010-04-25 15:50:01 +02:00
parent 74cc5a7a13
commit 4dc8f11887

View File

@ -3995,6 +3995,20 @@ static const struct db_init_query db_upgrade_v9_queries[] =
{ U_V9_SCVER, "set schema_version to 9" }, { U_V9_SCVER, "set schema_version to 9" },
}; };
/* Upgrade from schema v9 to v10 */
#define U_V10_PLVOL \
"INSERT INTO admin (key, value) VALUES ('player:volume', '75');"
#define U_V10_SCVER \
"UPDATE admin SET value = '10' WHERE key = 'schema_version';"
static const struct db_init_query db_upgrade_v10_queries[] =
{
{ U_V10_PLVOL, "store player start volume" },
{ U_V10_SCVER, "set schema_version to 10" },
};
static int static int
db_check_version(void) db_check_version(void)
{ {
@ -4087,6 +4101,13 @@ db_check_version(void)
if (ret < 0) if (ret < 0)
return -1; return -1;
/* FALLTHROUGH */
case 9:
ret = db_generic_upgrade(db_upgrade_v10_queries, sizeof(db_upgrade_v10_queries) / sizeof(db_upgrade_v10_queries[0]));
if (ret < 0)
return -1;
break; break;
default: default: