1

I get the following error when I try to run this migration:

==  AddUniquenessConstraintOnAwards: migrating ================================
-- add_index(:awards, [:badge_id, :game_week_id], {:unique=>true, :name=>:game_badge_index})
rake aborted!
An error has occurred, all later migrations canceled:

Mysql::Error: Duplicate entry '35-8192' for key 'game_badge_index': CREATE UNIQUE INDEX `game_badge_index` ON `awards` (`badge_id`, `game_week_id`)

Has anyone encountered? What's the error telling me? How did you troubleshoot it and ultimately fix it?

1 Answer 1

4

The error is telling you that there is at least two records in your awards table that have the same values for badge_id and game_week_id (entry 35-8192), and such duplicate entries aren't permitted for a Unique index

To fix it, you eliminate the duplicate records

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.