summary refs log tree commit diff
path: root/synapse/storage/__init__.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-03-04 13:52:18 +0000
committerErik Johnston <erik@matrix.org>2015-03-04 13:52:18 +0000
commit5eefd1f618a19cc27cfdaf915dc3abd3720cd0e7 (patch)
tree4799fd86330ca135e4a17275b7ab6b92b493b294 /synapse/storage/__init__.py
parentChange to use logger in db upgrade script (diff)
downloadsynapse-5eefd1f618a19cc27cfdaf915dc3abd3720cd0e7.tar.xz
Add unique constraint on schema_version.lock schema. Use conflict clause in sql.
Diffstat (limited to 'synapse/storage/__init__.py')
-rw-r--r--synapse/storage/__init__.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/synapse/storage/__init__.py b/synapse/storage/__init__.py
index d637e8c4f7..c09228c37f 100644
--- a/synapse/storage/__init__.py
+++ b/synapse/storage/__init__.py
@@ -645,7 +645,7 @@ def _setup_new_database(cur):
     cur.executescript(sql_script)
 
     cur.execute(
-        "INSERT INTO schema_version (version, upgraded)"
+        "INSERT OR REPLACE INTO schema_version (version, upgraded)"
         " VALUES (?,?)",
         (max_current_ver, False)
     )
@@ -748,7 +748,7 @@ def _upgrade_existing_database(cur, current_version, delta_files, upgraded):
             )
 
             cur.execute(
-                "INSERT INTO schema_version (version, upgraded)"
+                "INSERT OR REPLACE INTO schema_version (version, upgraded)"
                 " VALUES (?,?)",
                 (v, True)
             )
@@ -803,7 +803,7 @@ def prepare_sqlite3_database(db_conn):
 
             if row and row[0]:
                 db_conn.execute(
-                    "INSERT INTO schema_version (version, upgraded)"
+                    "INSERT OR REPLACE INTO schema_version (version, upgraded)"
                     " VALUES (?,?)",
                     (row[0], False)
                 )