forked from louislam/uptime-kuma
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Uptime calculation improvement and 1-year uptime (louislam#2750)
- Loading branch information
Showing
22 changed files
with
1,306 additions
and
264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
exports.up = function (knex) { | ||
return knex.schema | ||
.createTable("stat_minutely", function (table) { | ||
table.increments("id"); | ||
table.comment("This table contains the minutely aggregate statistics for each monitor"); | ||
table.integer("monitor_id").unsigned().notNullable() | ||
.references("id").inTable("monitor") | ||
.onDelete("CASCADE") | ||
.onUpdate("CASCADE"); | ||
table.integer("timestamp") | ||
.notNullable() | ||
.comment("Unix timestamp rounded down to the nearest minute"); | ||
table.float("ping").notNullable().comment("Average ping in milliseconds"); | ||
table.smallint("up").notNullable(); | ||
table.smallint("down").notNullable(); | ||
|
||
table.unique([ "monitor_id", "timestamp" ]); | ||
}) | ||
.createTable("stat_daily", function (table) { | ||
table.increments("id"); | ||
table.comment("This table contains the daily aggregate statistics for each monitor"); | ||
table.integer("monitor_id").unsigned().notNullable() | ||
.references("id").inTable("monitor") | ||
.onDelete("CASCADE") | ||
.onUpdate("CASCADE"); | ||
table.integer("timestamp") | ||
.notNullable() | ||
.comment("Unix timestamp rounded down to the nearest day"); | ||
table.float("ping").notNullable().comment("Average ping in milliseconds"); | ||
table.smallint("up").notNullable(); | ||
table.smallint("down").notNullable(); | ||
|
||
table.unique([ "monitor_id", "timestamp" ]); | ||
}); | ||
}; | ||
|
||
exports.down = function (knex) { | ||
return knex.schema | ||
.dropTable("stat_minutely") | ||
.dropTable("stat_daily"); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
exports.up = function (knex) { | ||
// Add new column heartbeat.end_time | ||
return knex.schema | ||
.alterTable("heartbeat", function (table) { | ||
table.datetime("end_time").nullable().defaultTo(null); | ||
}); | ||
|
||
}; | ||
|
||
exports.down = function (knex) { | ||
// Rename heartbeat.start_time to heartbeat.time | ||
return knex.schema | ||
.alterTable("heartbeat", function (table) { | ||
table.dropColumn("end_time"); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.