summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorDaniel Wagner-Hall <daniel@matrix.org>2016-03-08 17:32:29 +0000
committerDaniel Wagner-Hall <daniel@matrix.org>2016-03-08 17:32:29 +0000
commitedca2d989137680093c4acdcaf6ca4029f11a335 (patch)
treef4727bfee7cd80e7c21c038e878771e7092b584a /synapse/storage
parentMerge pull request #571 from matrix-org/daniel/asids (diff)
downloadsynapse-edca2d989137680093c4acdcaf6ca4029f11a335.tar.xz
Idempotent-ise schema update script
If any ASes don't have an ID, the schema will fail, and then it will
error when trying to add the column again.
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/schema/delta/30/as_users.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/storage/schema/delta/30/as_users.py b/synapse/storage/schema/delta/30/as_users.py
index 4cf4dd0917..4da3c59de2 100644
--- a/synapse/storage/schema/delta/30/as_users.py
+++ b/synapse/storage/schema/delta/30/as_users.py
@@ -20,7 +20,11 @@ logger = logging.getLogger(__name__)
 
 def run_upgrade(cur, database_engine, config, *args, **kwargs):
     # NULL indicates user was not registered by an appservice.
-    cur.execute("ALTER TABLE users ADD COLUMN appservice_id TEXT")
+    try:
+        cur.execute("ALTER TABLE users ADD COLUMN appservice_id TEXT")
+    except:
+        # Maybe we already added the column? Hope so...
+        pass
 
     cur.execute("SELECT name FROM users")
     rows = cur.fetchall()