adamcharnock / django-hordak

Double entry accounting in Django
http://django-hordak.readthedocs.io
MIT License
254 stars 58 forks source link

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

Closed paeduardo closed 2 years ago

paeduardo commented 2 years ago

Hi! Could you include migrations in the package? /usr/local/lib/python3.9/site-packages/hordak/migrations/0030_auto_20220315_1433.py

PetrDlouhy commented 2 years ago

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?

paeduardo commented 2 years ago

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

paeduardo commented 2 years ago

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

PetrDlouhy commented 2 years ago

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).

paeduardo commented 2 years ago

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