uptime-kuma/db/knex_migrations/2023-06-30-1413-add-parent-monitor.js
2023-06-30 17:26:37 +08:00

19 lines
517 B
JavaScript

/*
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");
});
};