adamcharnock/django-hordak

Could you include migrations/0030_auto_20220315_xxxx.py in the package?

paeduardo opened this issue · 5 comments

Hi!
Could you include migrations in the package?
/usr/local/lib/python3.9/site-packages/hordak/migrations/0030_auto_20220315_1433.py
- Alter field amount on leg
- Alter field amount on statementline
Best regards,
Pawel

Hi,

if I try to run makemigrations on example_project it doesn't show any missing migrations. Did you set any of HORDAK_DECIMAL_PLACES or HORDAK_MAX_DIGITS settings in your project?

I have following settings:
DEFAULT_CURRENCY = "PLN" CURRENCIES = ["PLN","CHF"] HORDAK_DECIMAL_PLACES = 2 HORDAK_MAX_DIGITS = 10

Hi, I got it:
if HORDAK_MAX_DIGITS = 13 it doesn't show any missing migrations. However, if there is other value (like I had HORDAK_MAX_DIGITS = 10) makemigrations generated file
`from django.db import migrations, models
import djmoney.models.fields

class Migration(migrations.Migration):

dependencies = [
    ('hordak', '0029_alter_leg_amount_currency_and_more'),
]

operations = [
    migrations.AlterField(
        model_name='leg',
        name='amount',
        field=djmoney.models.fields.MoneyField(decimal_places=2, default_currency='EUR', help_text='Record debits as positive, credits as negative', max_digits=10, verbose_name='amount'),
    ),
    migrations.AlterField(
        model_name='statementline',
        name='amount',
        field=models.DecimalField(decimal_places=2, max_digits=10, verbose_name='amount'),
    ),
]`

As workaround I set HORDAK_MAX_DIGITS = 13

Yes, HORDAK_MAX_DIGITS = 13 is the default value. In other cases you would have to keep your own migrations as written in the documentation: https://django-hordak.readthedocs.io/en/latest/installation.html?highlight=HORDAK_DECIMAL_PLACES#installation

Or more precise, if you change the value after initial migrations run, you will have to keep your own migrations (or use fake migrations to get the DB to the state where it complies with the migrations).

@PetrDlouhy thanks for explanation! I am closing the issue.