From 277d6fe0cee9306d4e298d8ed53f5474c3682928 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Sun, 27 Oct 2024 20:30:44 +0800 Subject: [PATCH] Fix #5087 and fix migration state (#5260) --- .../2024-11-27-1927-fix-info-json-data-type.js | 13 +++++++++++++ server/database.js | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 db/knex_migrations/2024-11-27-1927-fix-info-json-data-type.js diff --git a/db/knex_migrations/2024-11-27-1927-fix-info-json-data-type.js b/db/knex_migrations/2024-11-27-1927-fix-info-json-data-type.js new file mode 100644 index 000000000..0f3f75e5b --- /dev/null +++ b/db/knex_migrations/2024-11-27-1927-fix-info-json-data-type.js @@ -0,0 +1,13 @@ +// Update info_json column to LONGTEXT mainly for MariaDB +exports.up = function (knex) { + return knex.schema + .alterTable("monitor_tls_info", function (table) { + table.text("info_json", "longtext").alter(); + }); +}; + +exports.down = function (knex) { + return knex.schema.alterTable("monitor_tls_info", function (table) { + table.text("info_json", "text").alter(); + }); +}; diff --git a/server/database.js b/server/database.js index 75f5f25cf..eb4594356 100644 --- a/server/database.js +++ b/server/database.js @@ -775,8 +775,6 @@ class Database { await migrationServer.start(port, hostname); } - await Settings.set("migrateAggregateTableState", "migrating"); - log.info("db", "Migrating Aggregate Table"); log.info("db", "Getting list of unique monitors"); @@ -799,6 +797,8 @@ class Database { } } + await Settings.set("migrateAggregateTableState", "migrating"); + let progressPercent = 0; let part = 100 / monitors.length; let i = 1;