Use alembic migrations to deploy Monasca DB

Support has recently been added for managing the Monasca DB
with alembic. This change takes advantage of that.

Partially-Implements: blueprint monasca-containers
Change-Id: I89084ac0076eff099e567b32de249df9f0115e82
This commit is contained in:
Doug Szumski 2018-09-19 16:34:04 +00:00
parent 3d4e284e13
commit ae8ce78e55
1 changed files with 1 additions and 9 deletions

View File

@ -5,15 +5,7 @@ SERVICE="monasca-api"
# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases
# of the KOLLA_BOOTSTRAP variable being set, including empty.
if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
# Set the database name in the monasca database schema
sed "s/USE \`mon\`;/USE \`${MONASCA_DATABASE_NAME}\`;/g" \
/monasca-api/devstack/files/schema/mon_mysql.sql > /tmp/mon_mysql.sql
# Load the schema
mysql --host=${MONASCA_DATABASE_ADDRESS} \
--port=${MONASCA_DATABASE_PORT} \
--user=${MONASCA_DATABASE_USER} \
--password=${MONASCA_DATABASE_PASSWORD} \
< /tmp/mon_mysql.sql
monasca_db upgrade
exit 0
fi