이 문제는 간단한 discourse_docker 공식 설치 환경에서도 발생했습니다. 매주 아침마다 파이프라인을 통해 자동 복구 테스트를 수행하고 있었는데, 실패한 파이프라인에 유사한 오류가 갑자기 나타났습니다.
I, [2026-05-20T07:59:01.413128 #1] INFO -- : > cd /var/www/discourse && su discourse -c 'bundle
exec rake db:migrate'
2026-05-20 07:59:09.214 UTC [1576] discourse@discourse ERROR: relation "translation_overrides" does not exist at character 523
2026-05-20 07:59:09.214 UTC [1576] discourse@discourse STATEMENT: SELECT a.attname, format_type(a.atttypid, a.atttypmod),
pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
c.collname, col_description(a.attrelid, a.attnum) AS comment,
attidentity AS identity,
attgenerated as attgenerated
FROM pg_attribute a
LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum
LEFT JOIN pg_type t ON a.atttypid = t.oid
LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation
WHERE a.attrelid = '"translation_overrides"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
2026-05-20 07:59:13.167 UTC [1627] discourse@discourse ERROR: schema "discourse_functions" already exists
2026-05-20 07:59:13.167 UTC [1627] discourse@discourse STATEMENT: CREATE SCHEMA discourse_functions;
psql:/var/www/discourse/db/structure.sql:16: ERROR: schema "discourse_functions" already exists
rake aborted!
근본 원인은 복구된 백업과 컨테이너 코드 간의 버전 불일치였습니다.
최신 Discourse 코드에는 translation_overrides를 참조하는 모델이 있지만, 프로덕션 데이터베이스(백업)는 이 테이블이 아직 존재하지 않거나 다른 이름으로 존재하는 이전 버전입니다.
제 경우 해결책은 먼저 재빌드(스키마를 처음부터 생성)한 다음 백업을 복구하는 것이었습니다. 복구 프로세스는 데이터베이스를 적절히 삭제하고 다시 생성하는 Discourse의 내장 복구 기능을 사용합니다.