aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/rpki-db-schema.sql5
-rw-r--r--scripts/graphviz-sql.sh13
2 files changed, 13 insertions, 5 deletions
diff --git a/docs/rpki-db-schema.sql b/docs/rpki-db-schema.sql
index 2a06132b..f2873766 100644
--- a/docs/rpki-db-schema.sql
+++ b/docs/rpki-db-schema.sql
@@ -157,6 +157,11 @@ ALTER TABLE bsc_cert
REFERENCES bsc;
+ALTER TABLE ca
+ ADD FOREIGN KEY (parent_id)
+ REFERENCES parent;
+
+
ALTER TABLE ca_detail
ADD FOREIGN KEY (ca_id)
REFERENCES ca;
diff --git a/scripts/graphviz-sql.sh b/scripts/graphviz-sql.sh
index a338404a..7ff0babd 100644
--- a/scripts/graphviz-sql.sh
+++ b/scripts/graphviz-sql.sh
@@ -12,13 +12,16 @@
for i in *.sql
do
- sqlt-graph --db MySQL --output-type canon --show-datatypes $i |
+ sqlt-graph --db MySQL --output-type canon --show-datatypes --show-constraints $i |
perl -0777 -pe '
s/\\\n/ /g;
- s/\\{//g;
- s/\\\|-\\ /|{/g;
- s/\\ *\\ *l *-\\ /|/g;
- s/\\ *\\l\\}/}/g;
+ s/ +/ /g;
+ s/\\\|/|/g;
+ s/\\{([a-z0-9_]+)\|/${1}|{/gi;
+ s/-\\ +//g;
+ s/\\ \\l/|/g;
+ s/\|\\l \\}/}/g;
+ s/\|\\}/}/g;
s/{\n/{\n\tedge [arrowtail=none, arrowhead=crow];\n/;
' |
tee ${i%.sql}.dot |