mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-05-29 01:42:34 +02:00
25 lines
779 B
JavaScript
25 lines
779 B
JavaScript
exports.up = async function (knex) {
|
|
await knex.schema.alterTable("notification", function (table) {
|
|
table.text("trigger").notNullable().defaultTo("up,down,certificate");
|
|
});
|
|
|
|
await knex("notification").whereNull("trigger").update({
|
|
trigger: "up,down,certificate",
|
|
});
|
|
|
|
const notifications = await knex("notification").select("*");
|
|
for (let n of notifications) {
|
|
await knex("notification").where("id", n.id).update({
|
|
config: JSON.stringify({
|
|
...JSON.parse(n.config),
|
|
trigger: "up,down,certificate",
|
|
}),
|
|
});
|
|
}
|
|
};
|
|
|
|
exports.down = function (knex) {
|
|
return knex.schema.alterTable("notification", function (table) {
|
|
table.dropColumn("trigger");
|
|
});
|
|
};
|