开发者

How to triage this MySQL duplicate entry error after running Rails migration?

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

==  AddUniquenessConstraintOnAwards: migrating ================================
-- add_ind开发者_开发问答ex(: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?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜