kpsul/provisioning/check_migrations_supportBDS.sh
2017-10-26 11:16:12 +02:00

46 lines
871 B
Bash

#!/bin/bash
set -e
function mysql_cmd {
mysql -uroot -p$DBPASSWD -e "$*"
}
# Recreate database.
if [ "$DJANGO_SETTINGS_MODULE" == "gestioCOF.settings.local" -o "_$DJANGO_SETTINGS_MODULE" == "_" ]; then
rm -f db.sqlite3
else
mysql_cmd DROP DATABASE $DBNAME >/dev/null
mysql_cmd CREATE DATABASE $DBNAME >/dev/null
fi
function dj-migrate {
python manage.py migrate -v0 $*
}
echo ">>> Mise en place de la BDD utilisant le schéma pré-supportBDS..."
dj-migrate auth
dj-migrate sites
dj-migrate contenttypes
dj-migrate admin
dj-migrate sessions
dj-migrate django_cas_ng
dj-migrate custommail
dj-migrate bda 0011
dj-migrate cof 0013
dj-migrate kfet 0061
echo "DONE."
echo ">>> Application des migrations supportBDS..."
dj-migrate
echo "DONE."
echo ">>> Les migrations supportBDS ont-elles fait du bon travail ?"
python manage.py check_olddata