Opened 4 years ago

Closed 4 years ago

#31257 closed Bug (worksforme)

Migrations don't apply changes for decimal_places on MySQL.

Reported by: Zbynek Drlik Owned by: nobody
Component: Migrations Version: 2.2
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Mariusz Felisiak)

I use mysql in django and have these migration file

class Migration(migrations.Migration):

    dependencies = [
        ('ft', '0010_auto_20191027_2255'),
    ]

    operations = [
        migrations.AlterField(
            model_name='polozkydokl',
            name='jedn_cena',
            field=djmoney.models.fields.MoneyField(decimal_places=4, default=Decimal('0'), default_currency='EUR', max_digits=12, verbose_name='Jednotková cena'),
        ),
    ]

Migration has been already applied but in db there is still old decimal_places=3 schema

| jedn_cena          | decimal(12,3) | NO   |     | NULL    |                |

python3 manage.py sqlmigrate ft 0011_auto_20200103_1523

BEGIN;
--
-- Alter field jedn_cena on polozkydokl
--
COMMIT;

Change History (1)

comment:1 by Mariusz Felisiak, 4 years ago

Description: modified (diff)
Resolution: worksforme
Status: newclosed
Summary: django migration has not been correctly applied for decimal_places - mysqlMigrations don't apply changes for decimal_places on MySQL.

I cannot reproduce this issues with DecimalField or djmoney.models.fields.MoneyField.

Note: See TracTickets for help on using tickets.
Back to Top