Skip to content
Snippets Groups Projects
Unverified Commit bca30cef authored by Richard van der Hoff's avatar Richard van der Hoff Committed by GitHub
Browse files

Improve diagnostics on database upgrade failure (#6570)

`Failed to upgrade database` is not helpful, and it's unlikely that UPGRADE.rst
has anything useful.
parent 0b794cbd
No related branches found
No related tags found
No related merge requests found
Improve diagnostics on database upgrade failure.
......@@ -342,13 +342,8 @@ def setup(config_options):
hs.setup()
except IncorrectDatabaseSetup as e:
quit_with_error(str(e))
except UpgradeDatabaseException:
sys.stderr.write(
"\nFailed to upgrade database.\n"
"Have you checked for version specific instructions in"
" UPGRADES.rst?\n"
)
sys.exit(1)
except UpgradeDatabaseException as e:
quit_with_error("Failed to upgrade database: %s" % (e,))
hs.setup_master()
......
......@@ -69,7 +69,10 @@ def prepare_database(db_conn, database_engine, config, data_stores=["main"]):
if user_version != SCHEMA_VERSION:
# If we don't pass in a config file then we are expecting to
# have already upgraded the DB.
raise UpgradeDatabaseException("Database needs to be upgraded")
raise UpgradeDatabaseException(
"Expected database schema version %i but got %i"
% (SCHEMA_VERSION, user_version)
)
else:
_upgrade_existing_database(
cur,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment