summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2020-01-09 17:46:52 +0000
committerRichard van der Hoff <richard@matrix.org>2020-01-09 18:11:04 +0000
commitbf468211805900e767b6b07a2bfa6046f70efb7a (patch)
treed6dacf0d5eeb1218889f5bb8919869a25131fab0 /scripts
parentCheck postgres version in check_database (diff)
downloadsynapse-bf468211805900e767b6b07a2bfa6046f70efb7a.tar.xz
Refuse to start if sqlite is older than 3.11.0
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/synapse_port_db16
1 files changed, 12 insertions, 4 deletions
diff --git a/scripts/synapse_port_db b/scripts/synapse_port_db
index a3dafaffc9..f135c8bc54 100755
--- a/scripts/synapse_port_db
+++ b/scripts/synapse_port_db
@@ -447,11 +447,15 @@ class Porter(object):
             else:
                 return
 
-    def build_db_store(self, db_config: DatabaseConnectionConfig):
+    def build_db_store(
+        self, db_config: DatabaseConnectionConfig, allow_outdated_version: bool = False,
+    ):
         """Builds and returns a database store using the provided configuration.
 
         Args:
-            config: The database configuration
+            db_config: The database configuration
+            allow_outdated_version: True to suppress errors about the database server
+                version being too old to run a complete synapse
 
         Returns:
             The built Store object.
@@ -463,7 +467,9 @@ class Porter(object):
         hs = MockHomeserver(self.hs_config)
 
         with make_conn(db_config, engine) as db_conn:
-            engine.check_database(db_conn)
+            engine.check_database(
+                db_conn, allow_outdated_version=allow_outdated_version
+            )
             prepare_database(db_conn, engine, config=None)
             store = Store(Database(hs, db_config, engine), db_conn, hs)
             db_conn.commit()
@@ -491,8 +497,10 @@ class Porter(object):
     @defer.inlineCallbacks
     def run(self):
         try:
+            # we allow people to port away from outdated versions of sqlite.
             self.sqlite_store = self.build_db_store(
-                DatabaseConnectionConfig("master-sqlite", self.sqlite_config)
+                DatabaseConnectionConfig("master-sqlite", self.sqlite_config),
+                allow_outdated_version=True,
             )
 
             # Check if all background updates are done, abort if not.