mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
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 in 7414704e88
.
This commit is contained in:
parent
1944f490f9
commit
797957fb48
4 changed files with 15 additions and 4 deletions
|
@ -10,6 +10,7 @@ field.
|
|||
"""
|
||||
|
||||
from datetime import datetime
|
||||
from decimal import Decimal
|
||||
|
||||
from django.db import models
|
||||
from django.db.models.functions import Coalesce, ExtractYear, Now, Pi
|
||||
|
@ -33,6 +34,9 @@ class DBArticle(models.Model):
|
|||
|
||||
headline = models.CharField(max_length=100, db_default="Default headline")
|
||||
pub_date = models.DateTimeField(db_default=Now())
|
||||
cost = models.DecimalField(
|
||||
max_digits=3, decimal_places=2, db_default=Decimal("3.33")
|
||||
)
|
||||
|
||||
class Meta:
|
||||
required_db_features = {"supports_expression_defaults"}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue