From 8e166e0dc62b15cd48439fadb82b92f9b192782b Mon Sep 17 00:00:00 2001 From: Joshua Hesketh Date: Fri, 1 May 2015 11:52:00 +1000 Subject: [PATCH] Add support to upgrade via Juno and Kilo Rather than stepping through the migrations just in master (which works fine assuming they are no different to previous releases) checkout the correct stable branch and walk through that. Change-Id: Iff79684990cbbaa8c6ed2474aca77a2f73d64b96 --- .../real_db_upgrade/nova_mysql_migrations.sh | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/turbo_hipster/task_plugins/real_db_upgrade/nova_mysql_migrations.sh b/turbo_hipster/task_plugins/real_db_upgrade/nova_mysql_migrations.sh index a346dd2..2a15bda 100755 --- a/turbo_hipster/task_plugins/real_db_upgrade/nova_mysql_migrations.sh +++ b/turbo_hipster/task_plugins/real_db_upgrade/nova_mysql_migrations.sh @@ -194,7 +194,35 @@ stable_release_db_sync() { db_sync "icehouse" fi - # TODO(jhesketh): Add in Juno here once released + version=`mysql -u $DB_USER --password=$DB_PASS $DB_NAME -e "select * from migrate_version \G" | grep version | sed 's/.*: //'` + # Some databases are from Icehouse + echo "Schema version is $version" + if [ $version -lt "254" ] + then + echo "Database is from Icehouse! Upgrade via Juno" + git branch -D stable/juno || true + git remote update + git checkout -b stable/juno + git reset --hard remotes/origin/stable/juno + pip_requires + db_sync "juno" + fi + + version=`mysql -u $DB_USER --password=$DB_PASS $DB_NAME -e "select * from migrate_version \G" | grep version | sed 's/.*: //'` + # Some databases are from Juno + echo "Schema version is $version" + if [ $version -lt "280" ] + then + echo "Database is from Juno! Upgrade via Kilo" + git branch -D stable/kilo || true + git remote update + git checkout -b stable/kilo + git reset --hard remotes/origin/stable/kilo + pip_requires + db_sync "kilo" + fi + + # TODO(jhesketh): Add in Liberty here once released # TODO(jhesketh): Make this more DRY and/or automatically match migration # numbers to releases.