mirror of
https://github.com/koichixD/uptime-kuma.git
synced 2026-09-04 17:23:21 +00:00
chore: cleanup and refactoring
This commit is contained in:
+4
-3
@@ -202,9 +202,10 @@ async function createTables() {
|
||||
table.text("footer_text");
|
||||
table.text("custom_css");
|
||||
table.boolean("show_powered_by").notNullable().defaultTo(true);
|
||||
table.string("google_analytics_tag_id");
|
||||
table.string("umami_analytics_domain_url");
|
||||
table.string("umami_analytics_website_id");
|
||||
table.string("analytics_id");
|
||||
table.string("analytics_domain_url");
|
||||
table.enu("analytics_type", [ "google", "umami", "plausible" ]).defaultTo(null);
|
||||
|
||||
});
|
||||
|
||||
// maintenance_status_page
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// Udpate status_page table to generalize analytics fields
|
||||
exports.up = function (knex) {
|
||||
return knex.schema
|
||||
.alterTable("status_page", function (table) {
|
||||
table.renameColumn("google_analytics_tag_id", "analytics_id");
|
||||
table.string("analytics_domain_url");
|
||||
table.enu("analytics_type", [ "google", "umami", "plausible" ]).defaultTo(null);
|
||||
|
||||
}).then(() => {
|
||||
// After a succesful migration, add google as default for previous pages
|
||||
knex("status_page").whereNotNull("analytics_id").update({
|
||||
"analytics_type": "google",
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
return knex.schema.alterTable("status_page", function (table) {
|
||||
table.renameColumn("analytics_id", "google_analytics_tag_id");
|
||||
table.dropColumn("analytics_domain_url");
|
||||
table.dropColumn("analytics_type");
|
||||
});
|
||||
};
|
||||
@@ -1,10 +0,0 @@
|
||||
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
ALTER TABLE status_page
|
||||
ADD umami_analytics_domain_url VARCHAR;
|
||||
|
||||
ALTER TABLE status_page
|
||||
ADD umami_analytics_website_id VARCHAR;
|
||||
|
||||
COMMIT;
|
||||
Reference in New Issue
Block a user