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.text
@ -23,7 +23,7 @@ class Migration(migrations.Migration):
django.db.models.functions.text.Substr("value_monetary", 1),
output_field=models.DecimalField(
decimal_places=2,
max_digits=125,
max_digits=65,
),
),
value_monetary__regex="^\\d+",
@ -32,12 +32,12 @@ class Migration(migrations.Migration):
django.db.models.functions.text.Substr("value_monetary", 4),
output_field=models.DecimalField(
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(

View File

@ -932,17 +932,17 @@ class CustomFieldInstance(models.Model):
value_monetary__regex=r"^\d+",
then=Cast(
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
default=Cast(
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,
)