mirror of
https://github.com/django/django.git
synced 2025-08-22 03:24:21 +00:00
[5.0.x] Fixed #34936 -- Fixed migration crash for DecimalField with db_default on SQLite.
CAST() must be wrapped in parentheses to be recognized as an expression on SQLite. Regression in7414704e88
. Backport of797957fb48
from main
This commit is contained in:
parent
b735b90f43
commit
8dde0504f3
4 changed files with 15 additions and 4 deletions
|
@ -27,7 +27,7 @@ class SQLiteNumericMixin:
|
|||
sql, params = self.as_sql(compiler, connection, **extra_context)
|
||||
try:
|
||||
if self.output_field.get_internal_type() == "DecimalField":
|
||||
sql = "CAST(%s AS NUMERIC)" % sql
|
||||
sql = "(CAST(%s AS NUMERIC))" % sql
|
||||
except FieldError:
|
||||
pass
|
||||
return sql, params
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue