From 790328a93cba3e2fd415ba1a33384e9136719055 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 8 May 2018 10:11:45 +0100 Subject: [PATCH] Require SQLite3 version 3.15 or above This is primarily to allow tuple comparisons in queries, though a better query optimiser and other improvements mean that using newer versions of sqlite is highly recommended anyway. --- synapse/storage/engines/__init__.py | 2 +- synapse/storage/engines/{sqlite3.py => sqlite3_engine.py} | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) rename synapse/storage/engines/{sqlite3.py => sqlite3_engine.py} (93%) diff --git a/synapse/storage/engines/__init__.py b/synapse/storage/engines/__init__.py index 8c868ece75..dab042bce0 100644 --- a/synapse/storage/engines/__init__.py +++ b/synapse/storage/engines/__init__.py @@ -15,7 +15,7 @@ from ._base import IncorrectDatabaseSetup from .postgres import PostgresEngine -from .sqlite3 import Sqlite3Engine +from .sqlite3_engine import Sqlite3Engine import importlib import platform diff --git a/synapse/storage/engines/sqlite3.py b/synapse/storage/engines/sqlite3_engine.py similarity index 93% rename from synapse/storage/engines/sqlite3.py rename to synapse/storage/engines/sqlite3_engine.py index 60f0fa7fb3..f359874581 100644 --- a/synapse/storage/engines/sqlite3.py +++ b/synapse/storage/engines/sqlite3_engine.py @@ -15,6 +15,7 @@ from synapse.storage.prepare_database import prepare_database +import sqlite3 import struct import threading @@ -25,6 +26,11 @@ class Sqlite3Engine(object): def __init__(self, database_module, database_config): self.module = database_module + if sqlite3.sqlite_version_info < (3, 15, 0): + raise RuntimeError( + "SQLite3 version is too old, Synapse requires 3.15 or later", + ) + # The current max state_group, or None if we haven't looked # in the DB yet. self._current_state_group_id = None