-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
e806b15
commit 79f9f14
Showing
7 changed files
with
136 additions
and
4 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright (C) 2024 Nethesis S.r.l. | ||
* http://www.nethesis.it - [email protected] | ||
* | ||
* SPDX-License-Identifier: GPL-2.0-only | ||
* | ||
* author: Giacomo Sanchietti <[email protected]> | ||
*/ | ||
CREATE TABLE IF NOT EXISTS units ( | ||
id SERIAL PRIMARY KEY, | ||
uuid TEXT NOT NULL, | ||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS mwan_events ( | ||
time TIMESTAMPTZ NOT NULL, | ||
unit_id INTEGER NOT NULL references units(id), | ||
wan TEXT NOT NULL, | ||
event TEXT NOT NULL, | ||
interface TEXT, | ||
UNIQUE (time, unit_id), | ||
CONSTRAINT fk_unit FOREIGN KEY(unit_id) REFERENCES units(id) ON DELETE CASCADE | ||
); | ||
|
||
SELECT | ||
create_hypertable('mwan_events', by_range('time'), if_not_exists => TRUE); |
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