uptime-kuma/db/knex_migrations/2023-06-30-1348-http-body-encoding.js

23 lines
780 B
JavaScript
Raw Normal View History

2023-06-30 09:26:37 +00:00
// ALTER TABLE monitor ADD http_body_encoding VARCHAR(25);
// UPDATE monitor SET http_body_encoding = 'json' WHERE (type = 'http' or type = 'keyword') AND http_body_encoding IS NULL;
exports.up = function (knex) {
return knex.schema.table("monitor", function (table) {
table.string("http_body_encoding", 25);
}).then(function () {
knex("monitor")
.where(function () {
this.where("type", "http").orWhere("type", "keyword");
})
.whereNull("http_body_encoding")
.update({
http_body_encoding: "json",
});
});
};
exports.down = function (knex) {
return knex.schema.table("monitor", function (table) {
table.dropColumn("http_body_encoding");
});
};