Merge branch 'master' into feature/umami-analytics-status-page

This commit is contained in:
Frank Elsinga
2025-12-25 02:20:35 +01:00
committed by GitHub
72 changed files with 6739 additions and 2022 deletions
@@ -0,0 +1,21 @@
exports.up = function (knex) {
return knex.schema
.alterTable("monitor", function (table) {
table.boolean("domain_expiry_notification").defaultTo(1);
})
.createTable("domain_expiry", (table) => {
table.increments("id");
table.datetime("last_check");
table.text("domain").unique().notNullable();
table.datetime("expiry");
table.integer("last_expiry_notification_sent").defaultTo(null);
});
};
exports.down = function (knex) {
return knex.schema
.alterTable("monitor", function (table) {
table.boolean("domain_expiry_notification").alter();
})
.dropTable("domain_expiry");
};
@@ -0,0 +1,37 @@
exports.up = async function (knex) {
const isSQLite = knex.client.dialect === "sqlite3";
if (isSQLite) {
// For SQLite: Use partial indexes with WHERE important = 1
// Drop existing indexes using IF EXISTS
await knex.raw("DROP INDEX IF EXISTS monitor_important_time_index");
await knex.raw("DROP INDEX IF EXISTS heartbeat_important_index");
// Create partial indexes with predicate
await knex.schema.alterTable("heartbeat", function (table) {
table.index([ "monitor_id", "time" ], "monitor_important_time_index", {
predicate: knex.whereRaw("important = 1")
});
table.index([ "important" ], "heartbeat_important_index", {
predicate: knex.whereRaw("important = 1")
});
});
}
// For MariaDB/MySQL: No changes (partial indexes not supported)
};
exports.down = async function (knex) {
const isSQLite = knex.client.dialect === "sqlite3";
if (isSQLite) {
// Restore original indexes
await knex.raw("DROP INDEX IF EXISTS monitor_important_time_index");
await knex.raw("DROP INDEX IF EXISTS heartbeat_important_index");
await knex.schema.alterTable("heartbeat", function (table) {
table.index([ "monitor_id", "important", "time" ], "monitor_important_time_index");
table.index([ "important" ]);
});
}
// For MariaDB/MySQL: No changes
};