summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-03-04 15:06:22 +0000
committerErik Johnston <erik@matrix.org>2015-03-04 15:06:22 +0000
commit17d319a20df6e92ddbb8ca5b9e08615d2975b466 (patch)
tree6ee6dbe1abb9709448b086964f0a6596612a1ace /synapse
parents/%r/%s/ (diff)
downloadsynapse-17d319a20df6e92ddbb8ca5b9e08615d2975b466.tar.xz
s/schema_deltas/applied_schema_deltas/
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/__init__.py16
-rw-r--r--synapse/storage/schema/schema_version.sql4
2 files changed, 11 insertions, 9 deletions
diff --git a/synapse/storage/__init__.py b/synapse/storage/__init__.py
index 98b877bd08..e2d5e5a41d 100644
--- a/synapse/storage/__init__.py
+++ b/synapse/storage/__init__.py
@@ -674,12 +674,13 @@ def _setup_new_database(cur):
     _upgrade_existing_database(
         cur,
         current_version=max_current_ver,
-        delta_files=[],
+        applied_delta_files=[],
         upgraded=False
     )
 
 
-def _upgrade_existing_database(cur, current_version, delta_files, upgraded):
+def _upgrade_existing_database(cur, current_version, applied_delta_files,
+                               upgraded):
     """Upgrades an existing database.
 
     Delta files can either be SQL stored in *.sql files, or python modules
@@ -712,8 +713,9 @@ def _upgrade_existing_database(cur, current_version, delta_files, upgraded):
 
     Args:
         cur (Cursor)
-        current_version (int): The current version of the schema
-        delta_files (list): A list of deltas that have already been applied
+        current_version (int): The current version of the schema.
+        applied_delta_files (list): A list of deltas that have already been
+            applied.
         upgraded (bool): Whether the current version was generated by having
             applied deltas or from full schema file. If `True` the function
             will never apply delta files for the given `current_version`, since
@@ -746,7 +748,7 @@ def _upgrade_existing_database(cur, current_version, delta_files, upgraded):
         directory_entries.sort()
         for file_name in directory_entries:
             relative_path = os.path.join(str(v), file_name)
-            if relative_path in delta_files:
+            if relative_path in applied_delta_files:
                 continue
 
             absolute_path = os.path.join(
@@ -781,7 +783,7 @@ def _upgrade_existing_database(cur, current_version, delta_files, upgraded):
 
             # Mark as done.
             cur.execute(
-                "INSERT INTO schema_deltas (version, file)"
+                "INSERT INTO applied_schema_deltas (version, file)"
                 " VALUES (?,?)",
                 (v, relative_path)
             )
@@ -807,7 +809,7 @@ def _get_or_create_schema_state(txn):
 
     if current_version:
         txn.execute(
-            "SELECT file FROM schema_deltas WHERE version >= ?",
+            "SELECT file FROM applied_schema_deltas WHERE version >= ?",
             (current_version,)
         )
         return current_version, txn.fetchall(), upgraded
diff --git a/synapse/storage/schema/schema_version.sql b/synapse/storage/schema/schema_version.sql
index 20b1481ba5..0431e2d051 100644
--- a/synapse/storage/schema/schema_version.sql
+++ b/synapse/storage/schema/schema_version.sql
@@ -21,10 +21,10 @@ CREATE TABLE IF NOT EXISTS schema_version(
     CONSTRAINT schema_version_lock_uniq UNIQUE (Lock)
 );
 
-CREATE TABLE IF NOT EXISTS schema_deltas(
+CREATE TABLE IF NOT EXISTS applied_schema_deltas(
     version INTEGER NOT NULL,
     file TEXT NOT NULL,
     CONSTRAINT schema_deltas_ver_file UNIQUE (version, file) ON CONFLICT IGNORE
 );
 
-CREATE INDEX IF NOT EXISTS schema_deltas_ver ON schema_deltas(version);
+CREATE INDEX IF NOT EXISTS schema_deltas_ver ON applied_schema_deltas(version);