diff --git a/sql/Makefile b/sql/Makefile index 4081f85e..eef10a16 100644 --- a/sql/Makefile +++ b/sql/Makefile @@ -1,52 +1,53 @@ # Depends: postgresql-client, postgresql-autodoc DBNAME = softwareheritage-dev DOCDIR = autodoc SQL_INIT = swh-init.sql SQL_SCHEMA = swh-schema.sql SQL_FUNC = swh-func.sql SQL_DATA = swh-data.sql SQLS = $(SQL_INIT) $(SQL_SCHEMA) $(SQL_FUNC) $(SQL_DATA) PSQL_BIN = psql PSQL_FLAGS = --single-transaction --echo-all PSQL = $(PSQL_BIN) $(PSQL_FLAGS) all: createdb: createdb-stamp createdb-stamp: $(SQL_INIT) createdb $(DBNAME) touch $@ filldb: filldb-stamp filldb-stamp: createdb-stamp cat $(SQLS) | $(PSQL) $(DBNAME) touch $@ dropdb: -dropdb $(DBNAME) dumpdb: swh.dump swh.dump: filldb-stamp pg_dump -Fc $(DBNAME) > $@ doc: autodoc-stamp $(DOCDIR)/swh.pdf autodoc-stamp: filldb-stamp test -d $(DOCDIR)/ || mkdir $(DOCDIR) postgresql_autodoc -d $(DBNAME) -f $(DOCDIR)/swh + cp -a $(DOCDIR)/swh.dot $(DOCDIR)/swh.dot.orig touch $@ $(DOCDIR)/swh.pdf: clusters.dot autodoc-stamp - bin/dot_add_content $(DOCDIR)/swh.dot clusters.dot + bin/dot_add_content $(DOCDIR)/swh.dot.orig clusters.dot > $(DOCDIR)/swh.dot dot -T pdf $(DOCDIR)/swh.dot > $(DOCDIR)/swh.pdf clean: rm -rf *-stamp $(DOCDIR)/ distclean: clean dropdb rm -f swh.dump .PHONY: all initdb createdb dropdb doc clean diff --git a/sql/bin/dot_add_content b/sql/bin/dot_add_content index 679fdf31..e0f507b3 100755 --- a/sql/bin/dot_add_content +++ b/sql/bin/dot_add_content @@ -1,20 +1,12 @@ #!/bin/bash -# Depends: moreutils - DOT_FILE="$1" DOT_EXTRA="$2" if [ -z "$DOT_FILE" -o -z "$DOT_EXTRA" ] ; then echo "Usage: $0 DOT_FILE DOT_EXTRA" exit 1 fi -if ! [ -x $(which sponge) ] ; then - echo "Can't find sponge. Please: apt-get install moreutils" - exit 1 -fi - -(head -n -1 "$DOT_FILE" ; - cat "$DOT_EXTRA" ; - echo "}") \ - | sponge "$DOT_FILE" +head -n -1 "$DOT_FILE" # all of $DOT_FILE but last line +cat "$DOT_EXTRA" +echo "}" diff --git a/sql/clusters.dot b/sql/clusters.dot index ac34985d..42d1e160 100644 --- a/sql/clusters.dot +++ b/sql/clusters.dot @@ -1,64 +1,72 @@ -subgraph cluster_meta { - label = "Meta"; - dbversion; -} -subgraph cluster_content { - label = "Content"; - content; -} +subgraph "logical_grouping" { + style = rounded; + bgcolor = gray95; + color = gray; + + subgraph cluster_meta { + label = <meta>; + dbversion; + } -subgraph cluster_directory { - label = "Directories"; - directory; - directory_entry_dir; - directory_entry_file; - directory_entry_rev; - directory_list_dir; - directory_list_file; - directory_list_rev; -} + subgraph cluster_content { + label = <content>; + content; + } -subgraph cluster_revision { - label = "Revisions"; - revision; - revision_history; - person; -} + subgraph cluster_directory { + label = <directories>; + directory; + directory_entry_dir; + directory_entry_file; + directory_entry_rev; + directory_list_dir; + directory_list_file; + directory_list_rev; + } -subgraph cluster_release { - label = "Releases"; - release; -} + subgraph cluster_revision { + label = <revisions>; + revision; + revision_history; + person; + } -subgraph cluster_occurrences { - label = "Occurrences"; - occurrence; - occurrence_history; -} + subgraph cluster_release { + label = <releases>; + release; + } -subgraph cluster_origins { - label = "Origins"; - origin; - fetch_history; -} + subgraph cluster_occurrences { + label = <occurrences>; + occurrence; + occurrence_history; + } -subgraph cluster_projects { - label = "Projects"; - project; - project_history; -} + subgraph cluster_origins { + label = <origins>; + origin; + fetch_history; + } -subgraph cluster_organization { - label = "Organizations"; - organization; - list_history; -} + subgraph cluster_projects { + label = <projects>; + project; + project_history; + } + + subgraph cluster_organization { + label = <organizations>; + organization; + list_history; + } + + { + edge [style = dashed]; -{ - edge [style = dashed]; + directory_entry_file -> content; + directory_entry_rev -> revision; + revision -> directory; + } - directory_entry_file -> content; - directory_entry_rev -> revision; - revision -> directory; }