I am trying to implement a unique_together
constraint on one of the models in my Django project. The decision to have a unique constraint was taken after test data was already created in the table.
Now while running migrations, I came across the following error:
django.db.utils.IntegrityError: UNIQUE constraint failed: movt_frt.frt_group_id, movt_frt.rec_loc_id, movt_frt.dis_loc_id
I have tried creating similar unique constraints on table that previously held no data and migrations happened successfully.
My question is:
Am I right in concluding that the Migration is failing because the table already has data residing in it?
Is there a way to do some changes to the migration file on the lines as discussed here and attempt migration again, to run successfully?
I am using Django ver. 2.0.6