Refactor migration to new knex migrations

This commit is contained in:
Bas Wieringa 2024-03-15 17:07:57 +01:00
parent e539e5aa73
commit 612581a5d5
3 changed files with 16 additions and 8 deletions

View file

@ -0,0 +1,16 @@
exports.up = function (knex) {
// Add new column status_page.hide_uptime_percentage
return knex.schema
.alterTable("status_page", function (table) {
table.boolean("hide_uptime_percentage").notNullable().defaultTo(false);
});
};
exports.down = function (knex) {
// Drop column status_page.hide_uptime_percentage
return knex.schema
.alterTable("status_page", function (table) {
table.dropColumn("hide_uptime_percentage");
});
};

View file

@ -1,7 +0,0 @@
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
BEGIN TRANSACTION;
ALTER TABLE status_page
ADD hide_uptime_percentage BOOLEAN default 0 NOT NULL;
COMMIT;

View file

@ -106,7 +106,6 @@ class Database {
"patch-notification-config.sql": true,
"patch-fix-kafka-producer-booleans.sql": true,
"patch-timeout.sql": true, // The last file so far converted to a knex migration file
"patch-add-hide-uptime-percentage.sql": true
};
/**