Upgrade failed PG::UniqueViolation -- could not create unique index "unique_post_links_ccnew"

I’ve got a standard install that is failing to upgrade to 2.8.0.beta2 with this error:

PG::UniqueViolation: ERROR:  could not create unique index "unique_post_links_ccnew"

it’s from

I, [2021-06-25T18:35:47.756688 #1]  INFO -- : == 20210525112226 RemoveLengthConstrainFromTopicLinkUrl: migrating ============

It doesn’t look like a corrupt index.

Does this help?

[6] pry(main)> TopicLink.where(url: bad_url).pluck(:id, :topic_id, :post_id, :user_id)
=> [[15733, 14351, 63616, 911], [16131, 14505, 63986, 911], [27141, 14505, 63986, 1152]]

I ended up just appending a badX to the duplicate URLs and then it worked. I’m not quite clear what problems this might generate in the future…