Add database migration to convert FLOAT(8,2) to FLOAT(20,2)

Co-authored-by: louislam <1336778+louislam@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-01-10 10:20:07 +00:00
parent 559403285b
commit c44f3aa9a3

View File

@ -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();
});
};