fhe
(Florian)
3월 26, 2025, 6:39오전
1
다음 명령을 실행하여 업데이트를 시도할 때 이 오류가 발생합니다.
./launcher rebuild app
ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR: could not create unique index "index_discourse_solved_solved_topics_on_answer_post_id" (ActiveRecord::RecordNotUnique)
DETAIL: Key (answer_post_id)=(201795) is duplicated.
이 문제를 해결하는 방법에 대해 아이디어가 있으신가요?
thoka
(Thomas Kalka)
3월 26, 2025, 8:00오전
3
rails 콘솔을 통해 SolvedTopic 레코드 중 하나를 삭제합니다:
DiscourseSolved::SolvedTopic.where(answer_post_id:201795).last.destroy
fhe
(Florian)
3월 26, 2025, 9:16오전
4
감사합니다. 해당 항목에 접근을 시도해 보았지만 다음과 같은 오류가 발생합니다.
NameError: uninitialized constant SolvedTopic
다른 아이디어가 있을까요?
fhe
(Florian)
3월 26, 2025, 9:32오전
5
지금 데이터베이스에 직접 연결하여 discourse_solved_solved_topics 테이블에서 중복된 answer_post_id가 있는 레코드를 삭제했습니다.
모든 것이 정상으로 돌아왔습니다. 빠른 답변에 다시 한번 감사드립니다!
thoka
(Thomas Kalka)
3월 26, 2025, 12:59오후
6
음. discourse-solved가 최근 업데이트 되었습니다.
이 오류가 데이터베이스 마이그레이션 중에 발생했을 가능성이 있습니다.
fhe
(Florian)
3월 26, 2025, 2:19오후
7
네, 이건 데이터베이스 마이그레이션 중에 일어난 일이었습니다.
fhe
(Florian)
3월 26, 2025, 5:07오후
9
훌륭합니다! 미리 알려주셔서 감사합니다. 해당 게시물을 해결책으로 표시했습니다.