Import failing with `could not create unique index`

Would I need to clean up IncomingLink and IncoingReferrer too, since referrer points at IncomingDomain and IncomingLink points at IncomingReferrer?

Doing the query now and will try to import another backup. Querying via postgres actually gives me different results than using Rails. But I guess that might be because of a default scope?