Backout unneeded changes.
parent
396fa974a1
commit
626f468155
|
@ -58,18 +58,6 @@ class BaseDatabaseEngine(Generic[ConnectionType, CursorType], metaclass=abc.ABCM
|
|||
"""Do we support the `RETURNING` clause in insert/update/delete?"""
|
||||
...
|
||||
|
||||
@property
|
||||
@abc.abstractmethod
|
||||
def supports_select_distinct_on(self) -> bool:
|
||||
"""Do we support the `DISTINCT ON` clause in SELECT?"""
|
||||
...
|
||||
|
||||
@property
|
||||
@abc.abstractmethod
|
||||
def supports_sequences(self) -> bool:
|
||||
"""Do we support the `CREATE SEQUENCE` clause?"""
|
||||
...
|
||||
|
||||
@abc.abstractmethod
|
||||
def check_database(
|
||||
self, db_conn: ConnectionType, allow_outdated_version: bool = False
|
||||
|
|
|
@ -189,16 +189,6 @@ class PostgresEngine(
|
|||
"""Do we support the `RETURNING` clause in insert/update/delete?"""
|
||||
return True
|
||||
|
||||
@property
|
||||
def supports_select_distinct_on(self) -> bool:
|
||||
"""Do we support the `DISTINCT ON` clause in SELECT?"""
|
||||
return True
|
||||
|
||||
@property
|
||||
def supports_sequences(self) -> bool:
|
||||
"""Do we support the `CREATE SEQUENCE` clause?"""
|
||||
return True
|
||||
|
||||
def is_connection_closed(self, conn: ConnectionType) -> bool:
|
||||
return bool(conn.closed)
|
||||
|
||||
|
|
|
@ -65,16 +65,6 @@ class Sqlite3Engine(BaseDatabaseEngine[sqlite3.Connection, sqlite3.Cursor]):
|
|||
"""Do we support the `RETURNING` clause in insert/update/delete?"""
|
||||
return sqlite3.sqlite_version_info >= (3, 35, 0)
|
||||
|
||||
@property
|
||||
def supports_select_distinct_on(self) -> bool:
|
||||
"""Do we support the `DISTINCT ON` clause in SELECT?"""
|
||||
return False
|
||||
|
||||
@property
|
||||
def supports_sequences(self) -> bool:
|
||||
"""Do we support the `CREATE SEQUENCE` clause?"""
|
||||
return False
|
||||
|
||||
def check_database(
|
||||
self, db_conn: sqlite3.Connection, allow_outdated_version: bool = False
|
||||
) -> None:
|
||||
|
|
|
@ -2,7 +2,7 @@ import logging
|
|||
from io import StringIO
|
||||
|
||||
from synapse.storage.database import LoggingTransaction
|
||||
from synapse.storage.engines import BaseDatabaseEngine
|
||||
from synapse.storage.engines import BaseDatabaseEngine, PostgresEngine
|
||||
from synapse.storage.prepare_database import execute_statements_from_stream
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -18,7 +18,7 @@ This migration updates the user_filters table as follows:
|
|||
|
||||
|
||||
def run_create(cur: LoggingTransaction, database_engine: BaseDatabaseEngine) -> None:
|
||||
if database_engine.supports_select_distinct_on:
|
||||
if isinstance(database_engine, PostgresEngine):
|
||||
select_clause = """
|
||||
SELECT DISTINCT ON (user_id, filter_id) user_id, filter_id, filter_json
|
||||
FROM user_filters
|
||||
|
|
|
@ -18,11 +18,11 @@ Adds a postgres SEQUENCE for generating application service transaction IDs.
|
|||
"""
|
||||
|
||||
from synapse.storage.database import LoggingTransaction
|
||||
from synapse.storage.engines import BaseDatabaseEngine, PsycopgEngine
|
||||
from synapse.storage.engines import BaseDatabaseEngine, PostgresEngine, PsycopgEngine
|
||||
|
||||
|
||||
def run_create(cur: LoggingTransaction, database_engine: BaseDatabaseEngine) -> None:
|
||||
if database_engine.supports_sequences:
|
||||
if isinstance(database_engine, PostgresEngine):
|
||||
# If we already have some AS TXNs we want to start from the current
|
||||
# maximum value. There are two potential places this is stored - the
|
||||
# actual TXNs themselves *and* the AS state table. At time of migration
|
||||
|
|
Loading…
Reference in New Issue