Do not lock table on SQLite when checking unsupported constraint

It is not needed as SQLite does not have an explicit lock mechanism but such
call restart the transaction anyway.
(grafted from 4cc5987a3b800121007968cebb5976a5cac2384b)

--HG--
branch : 7.0
This commit is contained in:
Cédric Krier committed 2025-04-27 17:20:45 +02:00
1 parent 27ad4351b2
commit 5432222efb
1 file changed
+2 -1
+2 -1
View File
@@ -2135,7 +2135,8 @@ class ModelSQL(ModelStorage):
continue
table = sql.table
if isinstance(sql, (Unique, Exclude)):
lock(connection, cls._table)
if backend.name != 'sqlite':
lock(connection, cls._table)
columns = list(sql.columns)
columns.insert(0, table.id)
in_max = transaction.database.IN_MAX // (len(columns) + 1)