I’m trying to restore a backup to a new site. It’s failed with this error:
[2017-05-25 21:35:33] EXCEPTION: An error has occurred, this and all later migrations canceled:
PG::DuplicateFunction: ERROR: function "first_unread_topic_for" already exists with same argument types
: CREATE FUNCTION first_unread_topic_for(user_id int)
RETURNS timestamp AS
$$
SELECT COALESCE(first_topic_unread_at, 'epoch'::timestamp)
FROM users u
JOIN user_stats ON user_id = u.id
WHERE u.id = $1
$$
LANGUAGE SQL STABLE