Skip to content

Migrations with automatic IDs #3

@qwenger

Description

@qwenger

Hi,

When I run manage.py makemigrations on my project that uses django-address-model, django wants to create a migration for the package:

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('django_address', '0001_initial'),
    ]

    operations = [
        migrations.AlterField(
            model_name='country',
            name='id',
            field=models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
        ),
        migrations.AlterField(
            model_name='district',
            name='id',
            field=models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
        ),
        migrations.AlterField(
            model_name='province',
            name='id',
            field=models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
        ),
        migrations.AlterField(
            model_name='subdistrict',
            name='id',
            field=models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
        ),
    ]

The problem seems to be that you forgot auto_created and verbose_name when changing the migration file from 2ebb8ce (with manual id field) to 87c52aa (with automatic id field).

You may need to adapt 0001_initial or add a new migration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions