diff --git a/trytond/CHANGELOG b/trytond/CHANGELOG index fb15bf2180..148eed13fe 100644 --- a/trytond/CHANGELOG +++ b/trytond/CHANGELOG @@ -1,3 +1,4 @@ +* Set minimal supported version of SQLite to 3.30.1 * Refactor of trytond.config to add cache * Handle URL host of the bus on login * Restrict sessions to the client's IP address diff --git a/trytond/trytond/backend/sqlite/__init__.py b/trytond/trytond/backend/sqlite/__init__.py index 05a01ca5be..6b1adab7d5 100644 --- a/trytond/trytond/backend/sqlite/__init__.py +++ b/trytond/trytond/backend/sqlite/__init__.py @@ -1,11 +1,17 @@ # This file is part of Tryton. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. +import sqlite3 +import sys + from .database import ( Database, DatabaseDataError, DatabaseIntegrityError, DatabaseOperationalError, DatabaseTimeoutError) from .table import TableHandler +if sqlite3.sqlite_version_info < (3, 30, 1): + sys.exit("Tryton sqlite backend requires version 3.30.1 or higher") + __all__ = [ Database, TableHandler, DatabaseIntegrityError, DatabaseDataError, DatabaseOperationalError, diff --git a/trytond/trytond/backend/sqlite/database.py b/trytond/trytond/backend/sqlite/database.py index ddd92428a3..5fa5ded10d 100644 --- a/trytond/trytond/backend/sqlite/database.py +++ b/trytond/trytond/backend/sqlite/database.py @@ -238,10 +238,6 @@ class SQLitePosition(Function): return 0 -def replace(text, pattern, replacement): - return str(text).replace(pattern, replacement) - - def now(): transaction = Transaction() return _nows.setdefault(transaction, {}).setdefault( @@ -443,8 +439,7 @@ class Database(DatabaseInterface): _list_cache_timestamp = {} flavor = Flavor( paramstyle='qmark', function_mapping=MAPPING, null_ordering=False, - max_limit=-1, - filter_=sqlite.sqlite_version_info >= (3, 30, 0)) + max_limit=-1, filter_=True) IN_MAX = 200 TYPES_MAPPING = { @@ -477,8 +472,6 @@ class Database(DatabaseInterface): self._conn.create_function('date_trunc', 2, date_trunc) self._conn.create_function('split_part', 3, split_part) self._conn.create_function('to_char', 2, to_char) - if sqlite.sqlite_version_info < (3, 3, 14): - self._conn.create_function('replace', 3, replace) self._conn.create_function('now', 0, now) self._conn.create_function('greatest', -1, greatest) self._conn.create_function('least', -1, least) diff --git a/trytond/trytond/backend/sqlite/table.py b/trytond/trytond/backend/sqlite/table.py index db8de64913..d1efb860f4 100644 --- a/trytond/trytond/backend/sqlite/table.py +++ b/trytond/trytond/backend/sqlite/table.py @@ -113,14 +113,11 @@ class TableHandler(TableHandlerInterface): cursor = Transaction().connection.cursor() if self.column_exist(old_name): if not self.column_exist(new_name): - if sqlite.sqlite_version_info >= (3, 25, 0): - cursor.execute('ALTER TABLE %s RENAME COLUMN %s TO %s' % ( - _escape_identifier(self.table_name), - _escape_identifier(old_name), - _escape_identifier(new_name))) - self._update_definitions(columns=True) - else: - self._recreate_table({old_name: {'name': new_name}}) + cursor.execute('ALTER TABLE %s RENAME COLUMN %s TO %s' % ( + _escape_identifier(self.table_name), + _escape_identifier(old_name), + _escape_identifier(new_name))) + self._update_definitions(columns=True) else: logger.warning( 'Unable to rename column %s on table %s to %s.',