Sergiusz Bazanski | 1fad2e5 | 2019-08-01 20:16:27 +0200 | [diff] [blame] | 1 | CREATE TABLE peer_checks ( |
| 2 | peer_id UUID NOT NULL, |
| 3 | id UUID DEFAULT gen_random_uuid(), |
| 4 | |
| 5 | check_name STRING NOT NULL, |
| 6 | check_time INT NOT NULL, |
| 7 | check_status STRING check ( |
| 8 | check_status = 'unknown' or |
| 9 | check_status = 'okay' or |
| 10 | check_status = 'failed' |
| 11 | ) NOT NULL, |
| 12 | check_message STRING NOT NULL, |
| 13 | delete BOOL NOT NULL, |
| 14 | |
| 15 | UNIQUE(peer_id, check_name), |
| 16 | PRIMARY KEY (peer_id, id), |
| 17 | CONSTRAINT fk_peer FOREIGN KEY (peer_id) REFERENCES peers (id) ON DELETE CASCADE |
| 18 | ) INTERLEAVE IN PARENT peers (peer_id); |