-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Add
stat_hourly
& min. max. ping (#4267)
Co-authored-by: Frank Elsinga <frank@elsinga.de>
- Loading branch information
1 parent
0060e46
commit bf1e3a3
Showing
4 changed files
with
383 additions
and
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
exports.up = function (knex) { | ||
return knex.schema | ||
.alterTable("stat_daily", function (table) { | ||
table.float("ping_min").notNullable().defaultTo(0).comment("Minimum ping during this period in milliseconds"); | ||
table.float("ping_max").notNullable().defaultTo(0).comment("Maximum ping during this period in milliseconds"); | ||
}) | ||
.alterTable("stat_minutely", function (table) { | ||
table.float("ping_min").notNullable().defaultTo(0).comment("Minimum ping during this period in milliseconds"); | ||
table.float("ping_max").notNullable().defaultTo(0).comment("Maximum ping during this period in milliseconds"); | ||
}); | ||
|
||
}; | ||
|
||
exports.down = function (knex) { | ||
return knex.schema | ||
.alterTable("stat_daily", function (table) { | ||
table.dropColumn("ping_min"); | ||
table.dropColumn("ping_max"); | ||
}) | ||
.alterTable("stat_minutely", function (table) { | ||
table.dropColumn("ping_min"); | ||
table.dropColumn("ping_max"); | ||
}); | ||
}; |
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,26 @@ | ||
exports.up = function (knex) { | ||
return knex.schema | ||
.createTable("stat_hourly", function (table) { | ||
table.increments("id"); | ||
table.comment("This table contains the hourly 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 hour"); | ||
table.float("ping").notNullable().comment("Average ping in milliseconds"); | ||
table.float("ping_min").notNullable().defaultTo(0).comment("Minimum ping during this period in milliseconds"); | ||
table.float("ping_max").notNullable().defaultTo(0).comment("Maximum ping during this period in milliseconds"); | ||
table.smallint("up").notNullable(); | ||
table.smallint("down").notNullable(); | ||
|
||
table.unique([ "monitor_id", "timestamp" ]); | ||
}); | ||
}; | ||
|
||
exports.down = function (knex) { | ||
return knex.schema | ||
.dropTable("stat_hourly"); | ||
}; |
Oops, something went wrong.