summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-12-16 14:20:32 +0000
committerErik Johnston <erik@matrix.org>2014-12-16 14:20:32 +0000
commit2e44714214af801906c9fbc3e1cb1bc8d6b92427 (patch)
tree7a25841c85d12a8feffcb932bc3fa80885db84db /synapse/storage
parentFix bugs in upgrade script. (diff)
downloadsynapse-2e44714214af801906c9fbc3e1cb1bc8d6b92427.tar.xz
Make failure to run appropraite upgrade scripts more helpful.
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/__init__.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/synapse/storage/__init__.py b/synapse/storage/__init__.py
index 62f89b8d8c..2e97bbab3b 100644
--- a/synapse/storage/__init__.py
+++ b/synapse/storage/__init__.py
@@ -526,6 +526,14 @@ def read_schema(schema):
         return schema_file.read()
 
 
+class PrepareDatabaseException(Exception):
+    pass
+
+
+class UpgradeDatabaseException(PrepareDatabaseException):
+    pass
+
+
 def prepare_database(db_conn):
     """ Set up all the dbs. Since all the *.sql have IF NOT EXISTS, so we
     don't have to worry about overwriting existing content.
@@ -542,6 +550,10 @@ def prepare_database(db_conn):
                 "Cannot use this database as it is too " +
                 "new for the server to understand"
             )
+        elif user_version < 10:
+            raise UpgradeDatabaseException(
+                "No delta for versions less than 10"
+            )
         elif user_version < SCHEMA_VERSION:
             logger.info(
                 "Upgrading database from version %d",