Error running remap after changing site url

looks like a constraint collision in the postgres analytics table. your database already includes records of the new domain on specific dates so the remap tool is likely creating duplicates and postgres is rejecting them.

i would try to delete the old domain records in the specific table only for the dates where the new domain already has data in order to preserve historical data and unblock the remap tool. do a safety backup first though.

try this:

cd /var/discourse
./launcher enter app
# create a safety backup
discourse backup
# enter the database console
sudo -u postgres psql discourse
/* find the exact table name tied to this index */
SELECT tablename 
FROM pg_indexes 
WHERE indexname = 'idx_bprd_rollups_date_referrer_unique';

assuming the query above returns browser_pageview_rollup_details then use that table name in the next query

/* delete the colliding analytics records */
DELETE FROM browser_pageview_rollup_details 
WHERE normalized_referrer = 'discourse.tobiaseigen.org' 
AND date IN (
    SELECT date 
    FROM browser_pageview_rollup_details 
    WHERE normalized_referrer = 'digitallysovereign.org'
);

/* exit postgres */
\q

then run the remap tool again

discourse remap discourse.tobiaseigen.org digitallysovereign.org

then use rebake_match rake task instead of full rebake

# rebake only posts containing the new domain string
rake posts:rebake_match["digitallysovereign.org"]