spport multi tenant syncdb and migration

Closes #4849
This commit is contained in:
Jérôme Schneider 2014-08-12 18:57:21 +02:00
parent a26c07dcc0
commit f0723ab489
3 changed files with 14 additions and 7 deletions

View File

@ -11,15 +11,12 @@
#export DEBUG=yes
# Define administrators / managers
export ADMINS='admin eo;admin@entrouvert.com'
#export ADMINS='admin eo;admin@entrouvert.com'
# Database configuration (please use dpkg-reconfigure portail-citoyen)
#export DATABASE_ENGINE='django.db.backends.sqlite3'
#export DATABASE_NAME='/var/lib/portail-citoyen2/portail-citoyen.db'
# Sentry / Raven configuration
#export export RAVEN_CONFIG_DSN='' # require package python-raven
# Log root directory
export LOG_ROOT='/var/log/portail-citoyen/portail-citoyen.log'

10
debian/conf/syncdb.sh vendored
View File

@ -2,6 +2,12 @@
. /etc/portail-citoyen/portail-citoyen2.conf
python /usr/lib/portail-citoyen/manage.py syncdb --all --noinput
python /usr/lib/portail-citoyen/manage.py migrate --fake --noinput
if [ $MULTITENANT_MODE = "yes" ]; then
python /usr/lib/portail-citoyen/manage.py sync_schemas --all --noinput
python /usr/lib/portail-citoyen/manage.py migrate_schemas --fake --noinput
else
python /usr/lib/portail-citoyen/manage.py syncdb --all --noinput
python /usr/lib/portail-citoyen/manage.py migrate --fake --noinput
fi

View File

@ -112,7 +112,11 @@ do_reload() {
do_migrate() {
log_action_msg "Applying new migrations .."
su $USER -p -c "/usr/bin/portail-citoyen-manage syncdb --migrate --noinput"
if [ $MULTITENANT_MODE = "yes" ]; then
su $USER -p -c "/usr/bin/portail-citoyen-manage sync_schemas --migrate --noinput"
else
su $USER -p -c "/usr/bin/portail-citoyen-manage syncdb --migrate --noinput"
fi
log_action_msg ".. done"
}