mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-05-22 14:52:35 +02:00
migrated from old to new migration system based on knex
This commit is contained in:
parent
003ffc2cc2
commit
e0166f5eca
4 changed files with 28 additions and 23 deletions
|
@ -548,20 +548,6 @@ ALTER TABLE monitor
|
||||||
table.double("timeout").defaultTo(0).notNullable();
|
table.double("timeout").defaultTo(0).notNullable();
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
|
||||||
patch-add-ping-advanced-options.sql
|
|
||||||
ALTER TABLE monitor ADD ping_count INTEGER default 1 not null;
|
|
||||||
ALTER TABLE monitor ADD ping_numeric BOOLEAN default true not null;
|
|
||||||
ALTER TABLE monitor ADD ping_deadline INTEGER default 10 not null;
|
|
||||||
ALTER TABLE monitor ADD ping_timeout INTEGER default 2 not null;
|
|
||||||
*/
|
|
||||||
await knex.schema.table("monitor", function (table) {
|
|
||||||
table.integer("ping_count").defaultTo(1).notNullable();
|
|
||||||
table.boolean("ping_numeric").defaultTo(true).notNullable();
|
|
||||||
table.integer("ping_deadline").defaultTo(10).notNullable();
|
|
||||||
table.integer("ping_timeout").defaultTo(2).notNullable();
|
|
||||||
});
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
patch-add-gamedig-given-port.sql
|
patch-add-gamedig-given-port.sql
|
||||||
ALTER TABLE monitor
|
ALTER TABLE monitor
|
||||||
|
|
27
db/knex_migrations/2025-03-04-0000-ping-advanced-options.js
Normal file
27
db/knex_migrations/2025-03-04-0000-ping-advanced-options.js
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
/* SQL:
|
||||||
|
ALTER TABLE monitor ADD ping_count INTEGER default 1 not null;
|
||||||
|
ALTER TABLE monitor ADD ping_numeric BOOLEAN default true not null;
|
||||||
|
ALTER TABLE monitor ADD ping_deadline INTEGER default 10 not null;
|
||||||
|
ALTER TABLE monitor ADD ping_timeout INTEGER default 2 not null;
|
||||||
|
*/
|
||||||
|
exports.up = function (knex) {
|
||||||
|
// Add new columns to table monitor
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("monitor", function (table) {
|
||||||
|
table.integer("ping_count").defaultTo(1).notNullable();
|
||||||
|
table.boolean("ping_numeric").defaultTo(true).notNullable();
|
||||||
|
table.integer("ping_deadline").defaultTo(10).notNullable();
|
||||||
|
table.integer("ping_timeout").defaultTo(2).notNullable();
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function (knex) {
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("monitor", function (table) {
|
||||||
|
table.dropColumn("ping_count");
|
||||||
|
table.dropColumn("ping_numeric");
|
||||||
|
table.dropColumn("ping_deadline");
|
||||||
|
table.dropColumn("ping_timeout");
|
||||||
|
});
|
||||||
|
};
|
|
@ -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 monitor ADD ping_count INTEGER default 1 not null;
|
|
||||||
ALTER TABLE monitor ADD ping_numeric BOOLEAN default true not null;
|
|
||||||
ALTER TABLE monitor ADD ping_deadline INTEGER default 10 not null;
|
|
||||||
ALTER TABLE monitor ADD ping_timeout INTEGER default 2 not null;
|
|
||||||
COMMIT;
|
|
|
@ -111,8 +111,7 @@ class Database {
|
||||||
"patch-notification-config.sql": true,
|
"patch-notification-config.sql": true,
|
||||||
"patch-fix-kafka-producer-booleans.sql": true,
|
"patch-fix-kafka-producer-booleans.sql": true,
|
||||||
"patch-timeout.sql": true,
|
"patch-timeout.sql": true,
|
||||||
"patch-monitor-tls-info-add-fk.sql": true,
|
"patch-monitor-tls-info-add-fk.sql": true, // The last file so far converted to a knex migration file
|
||||||
"patch-add-ping-advanced-options.sql": true, // The last file so far converted to a knex migration file
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue