diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-08-10 09:18:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-08-10 09:18:49 +0000 |
commit | dd814a7c1a8de056a79f7238578b09236edd5506 (patch) | |
tree | 429e7eed5a634a4efe9a6877ce66da8e64aa1782 /database/sqlite/sqlite_db_migration.c | |
parent | Adding upstream version 1.41.0. (diff) | |
download | netdata-dd814a7c1a8de056a79f7238578b09236edd5506.tar.xz netdata-dd814a7c1a8de056a79f7238578b09236edd5506.zip |
Adding upstream version 1.42.0.upstream/1.42.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'database/sqlite/sqlite_db_migration.c')
-rw-r--r-- | database/sqlite/sqlite_db_migration.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/database/sqlite/sqlite_db_migration.c b/database/sqlite/sqlite_db_migration.c index 1a6233fce..548b7de07 100644 --- a/database/sqlite/sqlite_db_migration.c +++ b/database/sqlite/sqlite_db_migration.c @@ -83,6 +83,11 @@ const char *database_migrate_v9_v10[] = { NULL }; +const char *database_migrate_v10_v11[] = { + "ALTER TABLE health_log ADD chart_name TEXT;", + NULL +}; + static int do_migration_v1_v2(sqlite3 *database, const char *name) { UNUSED(name); @@ -293,7 +298,6 @@ static int do_migration_v8_v9(sqlite3 *database, const char *name) static int do_migration_v9_v10(sqlite3 *database, const char *name) { - UNUSED(name); netdata_log_info("Running \"%s\" database migration", name); if (table_exists_in_database("alert_hash") && !column_exists_in_table("alert_hash", "chart_labels")) @@ -301,6 +305,16 @@ static int do_migration_v9_v10(sqlite3 *database, const char *name) return 0; } +static int do_migration_v10_v11(sqlite3 *database, const char *name) +{ + netdata_log_info("Running \"%s\" database migration", name); + + if (table_exists_in_database("health_log") && !column_exists_in_table("health_log", "chart_name")) + return init_database_batch(database, DB_CHECK_NONE, 0, &database_migrate_v10_v11[0]); + + return 0; +} + static int do_migration_noop(sqlite3 *database, const char *name) { UNUSED(database); @@ -354,6 +368,7 @@ DATABASE_FUNC_MIGRATION_LIST migration_action[] = { {.name = "v7 to v8", .func = do_migration_v7_v8}, {.name = "v8 to v9", .func = do_migration_v8_v9}, {.name = "v9 to v10", .func = do_migration_v9_v10}, + {.name = "v10 to v11", .func = do_migration_v10_v11}, // the terminator of this array {.name = NULL, .func = NULL} }; |