#31257: Migrations don't apply changes for decimal_places on MySQL.
-----------------------------+--------------------------------------
     Reporter:  zbynekdrlik  |                    Owner:  nobody
         Type:  Bug          |                   Status:  closed
    Component:  Migrations   |                  Version:  2.2
     Severity:  Normal       |               Resolution:  worksforme
     Keywords:               |             Triage Stage:  Unreviewed
    Has patch:  0            |      Needs documentation:  0
  Needs tests:  0            |  Patch needs improvement:  0
Easy pickings:  0            |                    UI/UX:  0
-----------------------------+--------------------------------------
Changes (by felixxm):

 * status:  new => closed
 * resolution:   => worksforme


Old description:

> 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;
>
> ```

New description:

 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;
 }}}

--

Comment:

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

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31257#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/069.d63dd58c43938e6cc82be05c4b7afc88%40djangoproject.com.

Reply via email to