summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gentoobrowse/.gitignore2
-rw-r--r--gentoobrowse/datasources/database.mk11
-rw-r--r--gentoobrowse/datasources/schema.mk5
3 files changed, 18 insertions, 0 deletions
diff --git a/gentoobrowse/.gitignore b/gentoobrowse/.gitignore
new file mode 100644
index 0000000..0fae0f4
--- /dev/null
+++ b/gentoobrowse/.gitignore
@@ -0,0 +1,2 @@
+datasources/current.sql
+datasources/patch.sql
diff --git a/gentoobrowse/datasources/database.mk b/gentoobrowse/datasources/database.mk
new file mode 100644
index 0000000..0d242d0
--- /dev/null
+++ b/gentoobrowse/datasources/database.mk
@@ -0,0 +1,11 @@
+.PHONY : database current.sql schema.sql
+
+database: patch.sql
+ psql -U gentoo gentoo -qf $<
+
+current.sql :
+ pg_dump -U gentoo gentoo -n gentoobrowse -s -E utf8 | grep -v _gentoo > $@
+
+patch.sql : current.sql schema.sql
+ apgdiff --add-transaction current.sql schema.sql | tee $@
+
diff --git a/gentoobrowse/datasources/schema.mk b/gentoobrowse/datasources/schema.mk
new file mode 100644
index 0000000..42d4586
--- /dev/null
+++ b/gentoobrowse/datasources/schema.mk
@@ -0,0 +1,5 @@
+.PHONY : schema.sql
+
+schema.sql :
+ pg_dump -U gentoo gentoo -n gentoobrowse -s -E utf8 | grep -v _gentoo | grep -v '^\(--\|\)$$' > $@
+