-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
139 additions
and
7 deletions.
There are no files selected for viewing
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
34 changes: 34 additions & 0 deletions
34
services/api/migrations/2023-12-02-231731_boundary_average/down.sql
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,34 @@ | ||
PRAGMA foreign_keys = off; | ||
CREATE TABLE down_boundary ( | ||
id INTEGER PRIMARY KEY NOT NULL, | ||
uuid TEXT NOT NULL UNIQUE, | ||
threshold_id INTEGER NOT NULL, | ||
statistic_id INTEGER NOT NULL, | ||
metric_id INTEGER NOT NULL UNIQUE, | ||
lower_limit DOUBLE, | ||
upper_limit DOUBLE, | ||
FOREIGN KEY (threshold_id) REFERENCES threshold (id), | ||
FOREIGN KEY (statistic_id) REFERENCES statistic (id), | ||
FOREIGN KEY (metric_id) REFERENCES metric (id) ON DELETE CASCADE | ||
); | ||
INSERT INTO down_boundary( | ||
id, | ||
uuid, | ||
threshold_id, | ||
statistic_id, | ||
metric_id, | ||
lower_limit, | ||
upper_limit | ||
) | ||
SELECT id, | ||
uuid, | ||
threshold_id, | ||
statistic_id, | ||
metric_id, | ||
lower_limit, | ||
upper_limit | ||
FROM boundary; | ||
DROP TABLE boundary; | ||
ALTER TABLE down_boundary | ||
RENAME TO boundary; | ||
PRAGMA foreign_keys = on; |
40 changes: 40 additions & 0 deletions
40
services/api/migrations/2023-12-02-231731_boundary_average/up.sql
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,40 @@ | ||
PRAGMA foreign_keys = off; | ||
CREATE TABLE up_boundary ( | ||
id INTEGER PRIMARY KEY NOT NULL, | ||
uuid TEXT NOT NULL UNIQUE, | ||
threshold_id INTEGER NOT NULL, | ||
statistic_id INTEGER NOT NULL, | ||
metric_id INTEGER NOT NULL UNIQUE, | ||
average DOUBLE NOT NULL, | ||
lower_limit DOUBLE, | ||
upper_limit DOUBLE, | ||
FOREIGN KEY (threshold_id) REFERENCES threshold (id), | ||
FOREIGN KEY (statistic_id) REFERENCES statistic (id), | ||
FOREIGN KEY (metric_id) REFERENCES metric (id) ON DELETE CASCADE | ||
); | ||
INSERT INTO up_boundary( | ||
id, | ||
uuid, | ||
threshold_id, | ||
statistic_id, | ||
metric_id, | ||
average, | ||
lower_limit, | ||
upper_limit | ||
) | ||
SELECT id, | ||
uuid, | ||
threshold_id, | ||
statistic_id, | ||
metric_id, | ||
( | ||
SELECT value | ||
FROM metric | ||
WHERE metric.id = boundary.metric_id | ||
LIMIT 1 | ||
), lower_limit, upper_limit | ||
FROM boundary; | ||
DROP TABLE boundary; | ||
ALTER TABLE up_boundary | ||
RENAME TO boundary; | ||
PRAGMA foreign_keys = on; |
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
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
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