Fix: force precision for mariadb

This commit is contained in:
shamoon 2024-09-29 09:26:41 -07:00
parent a9913bc79d
commit a838464064
2 changed files with 9 additions and 9 deletions

View File

@ -1,4 +1,4 @@
# Generated by Django 5.1.1 on 2024-09-29 16:13 # Generated by Django 5.1.1 on 2024-09-29 16:26
import django.db.models.functions.comparison import django.db.models.functions.comparison
import django.db.models.functions.text import django.db.models.functions.text
@ -23,7 +23,7 @@ class Migration(migrations.Migration):
django.db.models.functions.text.Substr("value_monetary", 1), django.db.models.functions.text.Substr("value_monetary", 1),
output_field=models.DecimalField( output_field=models.DecimalField(
decimal_places=2, decimal_places=2,
max_digits=125, max_digits=65,
), ),
), ),
value_monetary__regex="^\\d+", value_monetary__regex="^\\d+",
@ -32,12 +32,12 @@ class Migration(migrations.Migration):
django.db.models.functions.text.Substr("value_monetary", 4), django.db.models.functions.text.Substr("value_monetary", 4),
output_field=models.DecimalField( output_field=models.DecimalField(
decimal_places=2, decimal_places=2,
max_digits=125, max_digits=65,
), ),
), ),
output_field=models.DecimalField(decimal_places=2, max_digits=125), output_field=models.DecimalField(decimal_places=2, max_digits=65),
), ),
output_field=models.DecimalField(decimal_places=2, max_digits=125), output_field=models.DecimalField(decimal_places=2, max_digits=65),
), ),
), ),
migrations.AlterField( migrations.AlterField(

View File

@ -932,17 +932,17 @@ class CustomFieldInstance(models.Model):
value_monetary__regex=r"^\d+", value_monetary__regex=r"^\d+",
then=Cast( then=Cast(
Substr("value_monetary", 1), Substr("value_monetary", 1),
output_field=models.DecimalField(decimal_places=2, max_digits=125), output_field=models.DecimalField(decimal_places=2, max_digits=65),
), ),
), ),
# If the value starts with a 3-char currency symbol, use the rest of the string # If the value starts with a 3-char currency symbol, use the rest of the string
default=Cast( default=Cast(
Substr("value_monetary", 4), Substr("value_monetary", 4),
output_field=models.DecimalField(decimal_places=2, max_digits=125), output_field=models.DecimalField(decimal_places=2, max_digits=65),
), ),
output_field=models.DecimalField(decimal_places=2, max_digits=125), output_field=models.DecimalField(decimal_places=2, max_digits=65),
), ),
output_field=models.DecimalField(decimal_places=2, max_digits=125), output_field=models.DecimalField(decimal_places=2, max_digits=65),
db_persist=True, db_persist=True,
) )