summary refs log tree commit diff
path: root/synapse/storage/schema/common
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2021-06-11 14:45:53 +0100
committerGitHub <noreply@github.com>2021-06-11 14:45:53 +0100
commitc1b9922498dea4b2882d26a4eaef3e0a37e727fd (patch)
tree926ab9057e6276f7f11fb0b00d4107836b9484dd /synapse/storage/schema/common
parentUse the matching complement branch when running tests in CI. (#10160) (diff)
downloadsynapse-c1b9922498dea4b2882d26a4eaef3e0a37e727fd.tar.xz
Support for database schema version ranges (#9933)
This is essentially an implementation of the proposal made at https://hackmd.io/@richvdh/BJYXQMQHO, though the details have ended up looking slightly different.
Diffstat (limited to 'synapse/storage/schema/common')
-rw-r--r--synapse/storage/schema/common/schema_version.sql7
1 files changed, 7 insertions, 0 deletions
diff --git a/synapse/storage/schema/common/schema_version.sql b/synapse/storage/schema/common/schema_version.sql
index 42e5cb6df5..f41fde5d2d 100644
--- a/synapse/storage/schema/common/schema_version.sql
+++ b/synapse/storage/schema/common/schema_version.sql
@@ -20,6 +20,13 @@ CREATE TABLE IF NOT EXISTS schema_version(
     CHECK (Lock='X')
 );
 
+CREATE TABLE IF NOT EXISTS schema_compat_version(
+    Lock CHAR(1) NOT NULL DEFAULT 'X' UNIQUE,  -- Makes sure this table only has one row.
+    -- The SCHEMA_VERSION of the oldest synapse this database can be used with
+    compat_version INTEGER NOT NULL,
+    CHECK (Lock='X')
+);
+
 CREATE TABLE IF NOT EXISTS applied_schema_deltas(
     version INTEGER NOT NULL,
     file TEXT NOT NULL,