uptime-kuma/db/knex_migrations/2023-06-30-1413-add-parent-monitor.js

19 lines
517 B
JavaScript
Raw Normal View History

2023-06-30 05:26:37 -04:00
/*
ALTER TABLE monitor
ADD parent INTEGER REFERENCES [monitor] ([id]) ON DELETE SET NULL ON UPDATE CASCADE;
*/
exports.up = function (knex) {
return knex.schema.table("monitor", function (table) {
table.integer("parent").unsigned()
.references("id").inTable("monitor")
.onDelete("SET NULL")
.onUpdate("CASCADE");
});
};
exports.down = function (knex) {
return knex.schema.table("monitor", function (table) {
table.dropColumn("parent");
});
};