From cf155744662a2b6b0ce7d751f7d1429929b9a764 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Thu, 11 Jan 2018 15:02:47 +0100 Subject: [PATCH 1/2] Improve the migration message when having to downgrade the database --- lib/galaxy/model/migrate/check.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/model/migrate/check.py b/lib/galaxy/model/migrate/check.py index 7655774214e..8904a333201 100644 --- a/lib/galaxy/model/migrate/check.py +++ b/lib/galaxy/model/migrate/check.py @@ -110,8 +110,15 @@ def create_or_verify_database(url, galaxy_config_file, engine_options={}, app=No config_arg = '' if galaxy_config_file and os.path.abspath(os.path.join(os.getcwd(), 'config', 'galaxy.ini')) != galaxy_config_file: config_arg = ' -c %s' % galaxy_config_file.replace(os.path.abspath(os.getcwd()), '.') - raise Exception("Your database has version '%d' but this code expects version '%d'. Please backup your database and then migrate the schema by running 'sh manage_db.sh%s upgrade'." - % (db_schema.version, migrate_repository.versions.latest, config_arg)) + expect_msg = "Your database has version '%d' but this code expects version '%d'" % (db_schema.version, migrate_repository.versions.latest) + instructions = "" + if db_schema.version > migrate_repository.versions.latest: + instructions = "To downgrade the database schema you have to return to the newest Galaxy version. " + cmd_msg = "sh manage_db.sh%s downgrade %d" % (config_arg, migrate_repository.versions.latest) + else: + cmd_msg = "sh manage_db.sh%s upgrade" % config_arg + backup_msg = "Please backup your database and then migrate the database schema by running '%s'." % cmd_msg + raise Exception("%s. %s%s" % (expect_msg, instructions, backup_msg)) else: log.info("At database version %d" % db_schema.version) From 58cda0ddd1663c16ba9b4772d9d2334cb4d45543 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Thu, 11 Jan 2018 17:24:45 +0100 Subject: [PATCH 2/2] Slight wording tweak to migration message --- lib/galaxy/model/migrate/check.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/model/migrate/check.py b/lib/galaxy/model/migrate/check.py index 8904a333201..3fe5f987446 100644 --- a/lib/galaxy/model/migrate/check.py +++ b/lib/galaxy/model/migrate/check.py @@ -113,7 +113,7 @@ def create_or_verify_database(url, galaxy_config_file, engine_options={}, app=No expect_msg = "Your database has version '%d' but this code expects version '%d'" % (db_schema.version, migrate_repository.versions.latest) instructions = "" if db_schema.version > migrate_repository.versions.latest: - instructions = "To downgrade the database schema you have to return to the newest Galaxy version. " + instructions = "To downgrade the database schema you have to checkout the Galaxy version that you were running previously. " cmd_msg = "sh manage_db.sh%s downgrade %d" % (config_arg, migrate_repository.versions.latest) else: cmd_msg = "sh manage_db.sh%s upgrade" % config_arg