applique upgrade alembic dans le script de restoration

This commit is contained in:
Emmanuel Viennet 2021-09-25 12:33:37 +02:00
parent b015cf3f88
commit edc6da3005

View File

@ -76,11 +76,15 @@ then
echo "Suppression de la base $DBNAME..."
su -c "dropdb $DBNAME" "$SCODOC_USER" || die "Erreur destruction db"
fi
su -c "createdb $DBNAME" "$SCODOC_USER" || die "Erreur destruction db"
su -c "createdb $DBNAME" "$SCODOC_USER" || die "Erreur création db"
echo "Chargement de la base SQL..."
su -c "pg_restore -d $DBNAME ${SCODOC_VAR_DIR}/SCODOC.dump" "$SCODOC_USER" || die "Erreur chargement de la base SQL"
# -- Apply migrations if needed (only on "production" databse, = SCODOC sauf config particulière)
export FLASK_ENV="production"
su -c "(cd $SCODOC_DIR && source venv/bin/activate && flask db upgrade)" "$SCODOC_USER"
# -- Start ScoDoc
systemctl start scodoc9