summary refs log tree commit diff
path: root/synapse/app
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/app
parentFix bugs in upgrade script. (diff)
downloadsynapse-2e44714214af801906c9fbc3e1cb1bc8d6b92427.tar.xz
Make failure to run appropraite upgrade scripts more helpful.
Diffstat (limited to 'synapse/app')
-rwxr-xr-xsynapse/app/homeserver.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py
index a6e29c0860..140c99f18a 100755
--- a/synapse/app/homeserver.py
+++ b/synapse/app/homeserver.py
@@ -14,7 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from synapse.storage import prepare_database
+from synapse.storage import prepare_database, UpgradeDatabaseException
 
 from synapse.server import HomeServer
 
@@ -228,8 +228,15 @@ def setup():
 
     logger.info("Preparing database: %s...", db_name)
 
-    with sqlite3.connect(db_name) as db_conn:
-        prepare_database(db_conn)
+    try:
+        with sqlite3.connect(db_name) as db_conn:
+            prepare_database(db_conn)
+    except UpgradeDatabaseException:
+        sys.stderr.write(
+            "\nFailed to upgrade database.\n"
+            "Have you followed any instructions in UPGRADES.rst?\n"
+        )
+        sys.exit(1)
 
     logger.info("Database prepared in %s.", db_name)