forked from DGNum/gestioCOF
131c45e1c7
Run 'bash provisioning/check_migrations_supportBDS.sh' from the vagrant VM. This will do the following: - delete the existing database 'cof_gestion', if applicable, - apply migrations to render the database as pre-supportBDS, - the last pre-supportBDS migration of 'cof' app creates some instances using old database schema, - supportBDS migrations are applied, - finally, the 'check_olddata' command of 'cof' app ensures data has been correctly migrated. This commit should be reverted before reaching production stage.
40 lines
730 B
Bash
40 lines
730 B
Bash
#!/bin/bash
|
|
|
|
function mysql_cmd {
|
|
mysql -uroot -p$DBPASSWD -e "$*"
|
|
}
|
|
|
|
# Recreate database.
|
|
mysql_cmd DROP DATABASE $DBNAME >/dev/null 2>&1
|
|
mysql_cmd CREATE DATABASE $DBNAME >/dev/null 2>&1
|
|
|
|
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 0010
|
|
dj-migrate cof 0008
|
|
dj-migrate kfet 0047
|
|
|
|
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
|