[DRE-commits] [diaspora-installer] 11/12: check if db exist before initializing
Praveen Arimbrathodiyil
praveen at moszumanska.debian.org
Sun Aug 28 05:18:00 UTC 2016
This is an automated email from the git hooks/post-receive script.
praveen pushed a commit to branch master
in repository diaspora-installer.
commit 6b2aba36c9d6bfed55fdc1ea98c8ec910aca55f6
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date: Sun Aug 28 10:11:02 2016 +0530
check if db exist before initializing
---
debian/postinst | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/debian/postinst b/debian/postinst
index 411a7a5..4ffc511 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -49,11 +49,16 @@ https://github.com/hyperic/sigar/issues/60 ..."
echo "Installing gems with rubygems ..."
su diaspora -s /bin/sh -c "bundle install --path vendor/bundle --with $DB --without development test"
+ # Check if the db is already present
+ if [ "$(LANG=C su postgres -c "psql diaspora_production -c \"\d\"")" = \
+"No relations found." ]; then
echo "Initializing database..."
- su diaspora -s /bin/sh -c 'bundle exec rake db:schema:load'
-
- echo "Running migrations..."
- su diaspora -s /bin/sh -c 'bundle exec rake db:migrate'
+ su diaspora -s /bin/sh -c 'bundle exec rake db:schema:load'
+ else
+ echo "diaspora_production database is not empty, skipping database setup"
+ echo "Running migrations..."
+ su diaspora -s /bin/sh -c 'bundle exec rake db:migrate'
+ fi
echo "Precompiling assets..."
su diaspora -s /bin/sh -c 'bundle exec rake tmp:cache:clear assets:precompile'
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/diaspora-installer.git
More information about the Pkg-ruby-extras-commits
mailing list