AlterField shows the error `Duplicate key name` [duplicate]

In my migration file, there is the AlterField like this

    migrations.AlterField(
        model_name='historicalglobalparam',
        name='history_date',
        field=models.DateTimeField(db_index=True),
    ),

my table historicalglobalparam has history_date column

When appling this

$python manage.py migrate

The error appears

django.db.utils.OperationalError: (1061, "Duplicate key name 'shared_models_historicalglobalparam_history_date_26e0c543'")

However there comes error like this.

I wonder it's AlterField not AddField

Why this erorr comes?

Back to Top