From 05797e3165a810ff653cc62a10b2481adc62621b Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 7 Aug 2015 01:04:33 +0100 Subject: Schema tools --- gentoobrowse/.gitignore | 2 ++ gentoobrowse/datasources/database.mk | 11 +++++++++++ gentoobrowse/datasources/schema.mk | 5 +++++ 3 files changed, 18 insertions(+) create mode 100644 gentoobrowse/.gitignore create mode 100644 gentoobrowse/datasources/database.mk create mode 100644 gentoobrowse/datasources/schema.mk 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 '^\(--\|\)$$' > $@ + -- cgit v1.2.3