From c44f3aa9a3189c944988af99dc64f05bc07009fc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 10 Jan 2026 10:20:07 +0000 Subject: [PATCH] Add database migration to convert FLOAT(8,2) to FLOAT(20,2) Co-authored-by: louislam <1336778+louislam@users.noreply.github.com> --- ...2026-01-10-0000-convert-float-precision.js | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 db/knex_migrations/2026-01-10-0000-convert-float-precision.js diff --git a/db/knex_migrations/2026-01-10-0000-convert-float-precision.js b/db/knex_migrations/2026-01-10-0000-convert-float-precision.js new file mode 100644 index 000000000..1478c6d06 --- /dev/null +++ b/db/knex_migrations/2026-01-10-0000-convert-float-precision.js @@ -0,0 +1,37 @@ +exports.up = function (knex) { + return knex.schema + .alterTable("stat_minutely", function (table) { + table.float("ping", 20, 2).notNullable().comment("Average ping in milliseconds").alter(); + table.float("ping_min", 20, 2).notNullable().defaultTo(0).comment("Minimum ping during this period in milliseconds").alter(); + table.float("ping_max", 20, 2).notNullable().defaultTo(0).comment("Maximum ping during this period in milliseconds").alter(); + }) + .alterTable("stat_daily", function (table) { + table.float("ping", 20, 2).notNullable().comment("Average ping in milliseconds").alter(); + table.float("ping_min", 20, 2).notNullable().defaultTo(0).comment("Minimum ping during this period in milliseconds").alter(); + table.float("ping_max", 20, 2).notNullable().defaultTo(0).comment("Maximum ping during this period in milliseconds").alter(); + }) + .alterTable("stat_hourly", function (table) { + table.float("ping", 20, 2).notNullable().comment("Average ping in milliseconds").alter(); + table.float("ping_min", 20, 2).notNullable().defaultTo(0).comment("Minimum ping during this period in milliseconds").alter(); + table.float("ping_max", 20, 2).notNullable().defaultTo(0).comment("Maximum ping during this period in milliseconds").alter(); + }); +}; + +exports.down = function (knex) { + return knex.schema + .alterTable("stat_minutely", function (table) { + table.float("ping").notNullable().comment("Average ping in milliseconds").alter(); + table.float("ping_min").notNullable().defaultTo(0).comment("Minimum ping during this period in milliseconds").alter(); + table.float("ping_max").notNullable().defaultTo(0).comment("Maximum ping during this period in milliseconds").alter(); + }) + .alterTable("stat_daily", function (table) { + table.float("ping").notNullable().comment("Average ping in milliseconds").alter(); + table.float("ping_min").notNullable().defaultTo(0).comment("Minimum ping during this period in milliseconds").alter(); + table.float("ping_max").notNullable().defaultTo(0).comment("Maximum ping during this period in milliseconds").alter(); + }) + .alterTable("stat_hourly", function (table) { + table.float("ping").notNullable().comment("Average ping in milliseconds").alter(); + table.float("ping_min").notNullable().defaultTo(0).comment("Minimum ping during this period in milliseconds").alter(); + table.float("ping_max").notNullable().defaultTo(0).comment("Maximum ping during this period in milliseconds").alter(); + }); +};