bgpwtf/cccampix: draw the rest of the fucking owl
Change-Id: I49fd5906e69512e8f2d414f406edc0179522f225
diff --git a/bgpwtf/cccampix/verifier/model/migrations/1564664855_initial.up.sql b/bgpwtf/cccampix/verifier/model/migrations/1564664855_initial.up.sql
new file mode 100644
index 0000000..bab0c35
--- /dev/null
+++ b/bgpwtf/cccampix/verifier/model/migrations/1564664855_initial.up.sql
@@ -0,0 +1,27 @@
+CREATE TABLE peers (
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
+ asn STRING NOT NULL,
+ name STRING NOT NULL,
+ source STRING check (
+ source = 'from-peeringdb' or
+ source = 'manual'
+ ) NOT NULL,
+ UNIQUE (asn)
+);
+
+CREATE TABLE peer_routers (
+ peer_id UUID NOT NULL,
+ id UUID DEFAULT gen_random_uuid(),
+
+ v6 STRING,
+ v4 STRING,
+ source STRING check (
+ source = 'from-peeringdb' or
+ source = 'manual'
+ ) NOT NULL,
+
+ UNIQUE (v4),
+ UNIQUE (v6),
+ PRIMARY KEY (peer_id, id),
+ CONSTRAINT fk_peer FOREIGN KEY (peer_id) REFERENCES peers (id) ON DELETE CASCADE
+) INTERLEAVE IN PARENT peers (peer_id);