summary refs log tree commit diff
path: root/synapse/storage/prepare_database.py
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2019-12-19 14:53:15 +0000
committerGitHub <noreply@github.com>2019-12-19 14:53:15 +0000
commitbca30cefee3849813565dd71e571172818629d85 (patch)
treed958b04ebf70806c7f57e0a0c49acaf055811b61 /synapse/storage/prepare_database.py
parentFix sdnotify with acme enabled (#6571) (diff)
downloadsynapse-bca30cefee3849813565dd71e571172818629d85.tar.xz
Improve diagnostics on database upgrade failure (#6570)
`Failed to upgrade database` is not helpful, and it's unlikely that UPGRADE.rst
has anything useful.
Diffstat (limited to 'synapse/storage/prepare_database.py')
-rw-r--r--synapse/storage/prepare_database.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/synapse/storage/prepare_database.py b/synapse/storage/prepare_database.py
index b4194b44ee..0195edf4ac 100644
--- a/synapse/storage/prepare_database.py
+++ b/synapse/storage/prepare_database.py
@@ -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,