root@digitallysovereign:/var/discourse# ./launcher enter app
x86_64 arch detected.
root@digitallysovereign-app:/var/www/discourse# discourse remap discourse.tobiaseigen.org digitallysovereign.org
Rewriting all occurrences of discourse.tobiaseigen.org to digitallysovereign.org
WILL RUN ON 'default' DB
THIS TASK WILL REWRITE DATA, ARE YOU SURE (type YES): YES
Remapping tables on default...
ai_api_audit_logs=919
ai_secrets=1
backup_metadata=1
browser_pageview_events=3664
Error: ERROR: duplicate key value violates unique constraint "idx_bprd_rollups_date_referrer_unique"
DETAIL: Key (date, normalized_referrer)=(2026-07-01, digitallysovereign.org) already exists.
The remap has only been partially applied due to the error above. Please re-run the script again.
root@digitallysovereign-app:/var/www/discourse# discourse remap discourse.tobiaseigen.org digitallysovereign.org
Rewriting all occurrences of discourse.tobiaseigen.org to digitallysovereign.org
WILL RUN ON 'default' DB
THIS TASK WILL REWRITE DATA, ARE YOU SURE (type YES): YES
Remapping tables on default...
Error: ERROR: duplicate key value violates unique constraint "idx_bprd_rollups_date_referrer_unique"
DETAIL: Key (date, normalized_referrer)=(2026-07-01, digitallysovereign.org) already exists.
The remap has only been partially applied due to the error above. Please re-run the script again.
root@digitallysovereign-app:/var/www/discourse# discourse remap discourse.tobiaseigen.org digitallysovereign.org
Rewriting all occurrences of discourse.tobiaseigen.org to digitallysovereign.org
WILL RUN ON 'default' DB
THIS TASK WILL REWRITE DATA, ARE YOU SURE (type YES): YES
Remapping tables on default...
Error: ERROR: duplicate key value violates unique constraint "idx_bprd_rollups_date_referrer_unique"
DETAIL: Key (date, normalized_referrer)=(2026-07-01, digitallysovereign.org) already exists.
The remap has only been partially applied due to the error above. Please re-run the script again.
포스트그레SQL 분석 테이블에서 제약 조건 충돌이 발생한 것으로 보입니다. 데이터베이스에 이미 특정 날짜에 대한 새 도메인 기록이 포함되어 있어, 리맵(remap) 도구가 중복을 생성하고 포스트그레SQL이 이를 거부하고 있을 가능성이 큽니다.
역사적 데이터를 보존하고 리맵 도구의 작동을 막지 않도록, 새 도메인에 이미 데이터가 있는 날짜에 대해서만 해당 테이블의 구 도메인 기록을 삭제하는 것을 시도해 보세요. 단, 먼저 안전 백업을 수행하세요.
다음과 같이 시도해 보세요:
cd /var/discourse
./launcher enter app
# 안전 백업 생성
discourse backup
# 데이터베이스 콘솔 진입
sudo -u postgres psql discourse
/* 이 인덱스에 연결된 정확한 테이블 이름 찾기 */
SELECT tablename
FROM pg_indexes
WHERE indexname = 'idx_bprd_rollups_date_referrer_unique';
위 쿼리가 browser_pageview_rollup_details를 반환한다고 가정하면, 다음 쿼리에서 해당 테이블 이름을 사용하세요.
/* 충돌하는 분석 기록 삭제 */
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'
);
/* 포스트그레SQL 종료 */
\q
discourse db는 저에게 작동하지 않아요 - 저는 sudo -u postgres psql discourse를 사용하고 있습니다.
첫 번째 쿼리가 반환한 테이블은 실제로 browser_pageview_referrer_daily_rollups였기 때문에 두 번째 쿼리에서 해당 테이블을 사용했습니다.
이제 다른 오류가 발생합니다. 두 번째 쿼리를 다시 실행해도 아무것도 삭제되지 않습니다.
Error: ERROR: duplicate key value violates unique constraint "idx_bprd_rollups_date_referrer_unique"
DETAIL: Key (date, normalized_referrer)=(2026-06-30, digitallysovereign.org/c/members/32) already exists.
The remap has only been partially applied due to the error above. Please re-run the script again.
음, 초기 쿼리가 정확한 일치(exact matching) 방식을 사용해서 경로가 붙어 있는 모든 행을 놓친 것 같네요. 이 SQL 쿼리를 시도해 볼 것 같습니다 (이름 서버에서 도메인 이름을 변경할 필요가 없어서 이 중 어떤 것도 실제로 테스트할 수 없거든요).
DELETE FROM browser_pageview_referrer_daily_rollups old_table
WHERE old_table.normalized_referrer LIKE '%discourse.tobiaseigen.org%'
AND EXISTS (
SELECT 1
FROM browser_pageview_referrer_daily_rollups new_table
WHERE new_table.date = old_table.date
AND new_table.normalized_referrer = REPLACE(old_table.normalized_referrer, 'discourse.tobiaseigen.org', 'digitallysovereign.org')
);
\q
이 쿼리가 오류 없이 작동하면, 위에서 언급한 remap 도구와 rebake rake 태스크를 실행하세요.
몇 달 전에 새 서버와 새 도메인 이름으로 포럼을 이전한 적이 있지만, remap 도구는 처음 시도했을 때 완벽하게 작동했습니다.
데이터베이스를 천천히 진행 중인 것 같아요. 24개의 기록이 삭제되었습니다! 이제 unique_post_links 단계에 왔습니다.
root@digitallysovereign-app:/var/www/discourse# discourse remap discourse.tobiaseigen.org digitallysovereign.org
Rewriting all occurrences of discourse.tobiaseigen.org to digitallysovereign.org
WILL RUN ON 'default' DB
THIS TASK WILL REWRITE DATA, ARE YOU SURE (type YES): yes
Remapping tables on default...
browser_pageview_referrer_daily_rollups=1466
categories=2
chat_message_links=4
chat_message_search_data=4
chat_messages=5
discourse_activity_pub_collections=1
discourse_activity_pub_objects=1
drafts=4
email_logs=797
group_histories=2
groups=2
incoming_emails=21
moved_posts=2
notifications=10
post_localizations=51
post_revisions=31
post_search_data=226
posts=774
site_settings=1
stylesheet_cache=1168
Error: ERROR: duplicate key value violates unique constraint "unique_post_links"
DETAIL: Key (topic_id, post_id, url)=(581, 3696, https://digitallysovereign.org) already exists.
The remap has only been partially applied due to the error above. Please re-run the script again.
SELECT tablename
FROM pg_indexes
WHERE indexname = 'unique_post_links';
topic_links를 반환해야 하지? 그렇다면 다음 논리적 단계는 이거야:
DELETE FROM topic_links old_link
WHERE old_link.url LIKE '%discourse.tobiaseigen.org%'
AND EXISTS (
SELECT 1
FROM topic_links new_link
WHERE new_link.topic_id = old_link.topic_id
AND new_link.post_id = old_link.post_id
AND new_link.url = REPLACE(old_link.url, 'discourse.tobiaseigen.org', 'digitallysovereign.org')
);
\q
이 부분이 데이터베이스 스키마의 거의 끝부분인 것 같으니, 위에서 공유한 remap과 rake 태스크를 실행하기 전에 마지막으로 넘어야 할 장벽(기대해 본다)일 가능성이 높다…
root@digitallysovereign-app:/var/www/discourse# discourse remap discourse.tobiaseigen.org digitallysovereign.org
Rewriting all occurrences of discourse.tobiaseigen.org to digitallysovereign.org
WILL RUN ON 'default' DB
THIS TASK WILL REWRITE DATA, ARE YOU SURE (type YES): yes
Remapping tables on default...
topic_links=1449
topic_search_data=11
topics=11
user_auth_token_logs=5
user_histories=131
Done
네, 이 명령어를 추가할 수 없는 이유는 데이터베이스 아키텍처에 따라 달라져야 하기 때문입니다. PR을 시도해 보았지만, 표준 설치와 듀얼 컨테이너 또는 멀티사이트 환경에서는 명령어가 다르기 때문에 실제 명령어가 작동하지 않았습니다. 스크립트는 Discourse 코어 컨테이너 내부에 위치해 있기 때문에, 관리자가 올바른 데이터베이스 컨테이너를 입력하더라도(비표준 설치의 경우) 명령어가 저장될 스크립트(script/discourse)가 듀얼 컨테이너 빌드의 경우 web_only.yml과 같은 컨테이너 외부에서 실행되므로 실패합니다. 기본적으로 이 명령어가 작동할 수 있는 유일한 경우는 애플리케이션과 데이터베이스가 동일한 컨테이너에 있는 표준 설치 환경입니다.