0

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?

whitebear
  • 11,200
  • 24
  • 114
  • 237

1 Answers1

1

You might already have an index on that field. Try and remove that index like this answer suggests

Felix Eklöf
  • 3,253
  • 2
  • 10
  • 27