Backup restoration fails

It sounds like your old server isn’t a standard install. Anyway,… what happened in short: an index on your old server got broken over the years (this can happen after OS upgrades), so two identical rows slipped into the incoming_referers table. The backup copies them as-is, and the new server then refuses them. So we fix it on the old server first, then make a new backup.

On the OLD server, open the Rails console:

./launcher enter app
rails c

Then paste these lines, one after the other:

db = ActiveRecord::Base.connection.current_database
DB.exec("DELETE FROM incoming_referers a USING incoming_referers b WHERE a.id > b.id AND a.path = b.path AND a.incoming_domain_id = b.incoming_domain_id")
DB.exec("REINDEX DATABASE #{ActiveRecord::Base.connection.quote_table_name(db)}")

This removes the duplicate and rebuilds all indexes (in case other tables are affected too).

If REINDEX finishes without an error, type exit, make a fresh backup on the old server, and restore that new file. If it shows an error about another table, just paste it here.