parent
d286c534bd
commit
e26abc3156
@ -1,22 +0,0 @@
|
||||
// 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");
|
||||
});
|
||||
};
|
@ -1,12 +0,0 @@
|
||||
// ALTER TABLE monitor ADD description TEXT default null;
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.table("monitor", function (table) {
|
||||
table.text("description").defaultTo(null);
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
return knex.schema.table("monitor", function (table) {
|
||||
table.dropColumn("description");
|
||||
});
|
||||
};
|
@ -1,30 +0,0 @@
|
||||
/*
|
||||
CREATE TABLE [api_key] (
|
||||
[id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
[key] VARCHAR(255) NOT NULL,
|
||||
[name] VARCHAR(255) NOT NULL,
|
||||
[user_id] INTEGER NOT NULL,
|
||||
[created_date] DATETIME DEFAULT (DATETIME('now')) NOT NULL,
|
||||
[active] BOOLEAN DEFAULT 1 NOT NULL,
|
||||
[expires] DATETIME DEFAULT NULL,
|
||||
CONSTRAINT FK_user FOREIGN KEY ([user_id]) REFERENCES [user]([id]) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
);
|
||||
*/
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.createTable("api_key", function (table) {
|
||||
table.increments("id").primary();
|
||||
table.string("key", 255).notNullable();
|
||||
table.string("name", 255).notNullable();
|
||||
table.integer("user_id").unsigned().notNullable()
|
||||
.references("id").inTable("user")
|
||||
.onDelete("CASCADE")
|
||||
.onUpdate("CASCADE");
|
||||
table.dateTime("created_date").defaultTo(knex.fn.now()).notNullable();
|
||||
table.boolean("active").defaultTo(1).notNullable();
|
||||
table.dateTime("expires").defaultTo(null);
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
return knex.schema.dropTable("api_key");
|
||||
};
|
@ -1,25 +0,0 @@
|
||||
/*
|
||||
ALTER TABLE monitor
|
||||
ADD tls_ca TEXT default null;
|
||||
|
||||
ALTER TABLE monitor
|
||||
ADD tls_cert TEXT default null;
|
||||
|
||||
ALTER TABLE monitor
|
||||
ADD tls_key TEXT default null;
|
||||
*/
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.table("monitor", function (table) {
|
||||
table.text("tls_ca").defaultTo(null);
|
||||
table.text("tls_cert").defaultTo(null);
|
||||
table.text("tls_key").defaultTo(null);
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
return knex.schema.table("monitor", function (table) {
|
||||
table.dropColumn("tls_ca");
|
||||
table.dropColumn("tls_cert");
|
||||
table.dropColumn("tls_key");
|
||||
});
|
||||
};
|
@ -1,25 +0,0 @@
|
||||
/*
|
||||
-- 999 characters. https://stackoverflow.com/questions/46134830/maximum-length-for-cron-job
|
||||
DROP TABLE maintenance_timeslot;
|
||||
ALTER TABLE maintenance ADD cron TEXT;
|
||||
ALTER TABLE maintenance ADD timezone VARCHAR(255);
|
||||
ALTER TABLE maintenance ADD duration INTEGER;
|
||||
*/
|
||||
exports.up = function (knex) {
|
||||
return knex.schema
|
||||
.dropTableIfExists("maintenance_timeslot")
|
||||
.table("maintenance", function (table) {
|
||||
table.text("cron");
|
||||
table.string("timezone", 255);
|
||||
table.integer("duration");
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
return knex.schema
|
||||
.table("maintenance", function (table) {
|
||||
table.dropColumn("cron");
|
||||
table.dropColumn("timezone");
|
||||
table.dropColumn("duration");
|
||||
});
|
||||
};
|
@ -1,18 +0,0 @@
|
||||
/*
|
||||
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");
|
||||
});
|
||||
};
|
Loading…
Reference in new issue