peeringdb / django-peeringdb

Django PeeringDB models
BSD 2-Clause "Simplified" License
21 stars 14 forks source link

Missing migration for changes on IXLan, Network, NetworkFacility and NetworkIXLan #100

Closed ercpe closed 5 months ago

ercpe commented 7 months ago

Hi,

we're in the process of integrating peeringdb/django-peeringdb in our application. As part of our CI pipeline we run poetry run python3 manage.py makemigrations --dry-run --check to make sure the model declaration matches the existing migrations and that migrations are in order.

The command fails because django-peeringdb is missing a database migration for the models IXLan, Network, NetworkFacility and NetworkIXLan:

/home/johann/.cache/pypoetry/virtualenvs/peeringdb-dummy-Qsf6NlwP-py3.11/lib/python3.11/site-packages/django_peeringdb/migrations/0030_alter_ixlan_rs_asn_alter_network_asn_and_more.py
    - Alter field rs_asn on ixlan
    - Alter field asn on network
    - Alter field local_asn on networkfacility
    - Alter field asn on networkixlan

When created, the migration looks like this:


    dependencies = [
        ('django_peeringdb', '0029_auto_20240109_1246'),
    ]

    operations = [
        migrations.AlterField(
            model_name='ixlan',
            name='rs_asn',
            field=django_inet.models.ASNField(blank=True, default=0, null=True, validators=[django.core.validators.MinValueValidator(0)], verbose_name='Route Server ASN'),
        ),
        migrations.AlterField(
            model_name='network',
            name='asn',
            field=django_inet.models.ASNField(unique=True, validators=[django.core.validators.MinValueValidator(0)], verbose_name='ASN'),
        ),
        migrations.AlterField(
            model_name='networkfacility',
            name='local_asn',
            field=django_inet.models.ASNField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0)], verbose_name='Local ASN'),
        ),
        migrations.AlterField(
            model_name='networkixlan',
            name='asn',
            field=django_inet.models.ASNField(validators=[django.core.validators.MinValueValidator(0)], verbose_name='ASN'),
        ),
    ]

django-peeringdb-3.3.0 peeringdb-2.0.0

Could you please verify the changes and add the migration? Running the command above in the CI might be a good idea too.

Thanks!

vegu commented 7 months ago

Thanks for the report.

At first glance these seem like idempotent changes, need to review and make sure the migrations for them are generated in any case.

cc @leovegoda