# chat\_mention 함수가 없어 복원 실패

**URL:** https://meta.discourse.org/t/restore-failing-with-missing-chat-mention-function/331376
**Category:** Bug
**Tags:** fixed
**Created:** [10월 17, 2024, 3:18오후 UTC](https://meta.discourse.org/t/restore-failing-with-missing-chat-mention-function/331376 "2024-10-17T15:18:47Z")
**Posts on this page:** 5
**Page:** 2

<div class="post-metadata">

### Author: ![dennisjbr](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dennisjbr/32/444916_2.png) [@dennisjbr](https://meta.discourse.org/u/dennisjbr)
#### Post date: [10월 21, 2024, 8:05오후 UTC](https://meta.discourse.org/t/restore-failing-with-missing-chat-mention-function/331376/28 "2024-10-21T20:05:50Z")

</div>

자, 업데이트 하나 더 드리겠습니다. 지난밤에 누락된 함수를 추가했을 때 이 샌드박스 인스턴스는 문제없이 잘 작동했습니다.

동일한 복원 파일을 사용하여 복원을 실행했을 때, 다시 오류가 발생했습니다. 어딘가에서 함수가 유실되는 것 같습니다. 전체 로그를 첨부합니다.

[restore.txt](https://meta.discourse.org/uploads/short-url/cnoAci8oN4THNaURSaVRNxplmzM.txt) (5.6 KB)

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [10월 22, 2024, 10:25오전 UTC](https://meta.discourse.org/t/restore-failing-with-missing-chat-mention-function/331376/29 "2024-10-22T10:25:43Z")

</div>

문제를 파악했습니다. 커밋 [82e75c8](https://github.com/discourse/discourse/commit/82e75c8700f4da7bccba6defa11b4b69b0f8ac3c)에서 `discourse_functions` 스키마에 함수를 생성했고, 커밋 [8016fca](https://github.com/discourse/discourse/commit/8016fcab332a2945bc3ad9676111841af3bc7fee)에서 해당 함수들을 삭제했습니다. `8016fca` 이후 버전에서 두 커밋 사이에 생성된 백업 복원을 시도하면 복원이 실패합니다.

복원 기능에는 이러한 문제를 위한 우회 처리가 포함되어 있지만, 플러그인 내에서 생성된 `discourse_functions`에는 적용되지 않았습니다. 이 문제를 수정할 PR은 다음과 같습니다:

> <https://github.com/discourse/discourse/pull/29332>
>
> Database dumps sometimes reference functions in the \`discourse\_functions\` schema…. It's possible that some of these functions have been dropped in a newer version of Discourse. In that case, restoring an older backup will fail with a \`ERROR: function discourse\_functions.something\_something() does not exist\` error. The restore functionality contains a workaround for that problem, but it didn't work with functions created in plugin migrations.
> 
> This commit adds support for temporarily creating missing \`discourse\_functions\` from plugins. And it adds a simple check if the DB migration file even contains the required \`DROPPED\_TABLES\` or \`DROPPED\_COLUMNS\` constant. We don't need to create an instance of the DB migration class unless one of those constants is used. This makes the restore slightly faster and works around a problem with migrations that execute without \`up\` or \`down\` methods (e.g. \`BackfillChatChannelAndThreadLastMessageIdsPostMigrate\`).

---

<div class="post-metadata">

### Author: ![Sbohengel](https://avatars.discourse-cdn.com/v4/letter/s/b19c9b/32.png) [@Sbohengel](https://meta.discourse.org/u/Sbohengel)
#### Post date: [10월 22, 2024, 9:45오후 UTC](https://meta.discourse.org/t/restore-failing-with-missing-chat-mention-function/331376/31 "2024-10-22T21:45:37Z")

</div>

정말 감사합니다. 저도 시도해 보겠습니다.

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [10월 22, 2024, 9:59오후 UTC](https://meta.discourse.org/t/restore-failing-with-missing-chat-mention-function/331376/32 "2024-10-22T21:59:12Z")

</div>

> 📢 이 문제는 해결되었습니다. Discourse를 최신 커밋으로 업데이트한 후 백업을 복원하면 정상적으로 작동합니다.

이 주제에서 언급된 새로운 백업 생성, 누락된 함수 수동 생성, 기타 임시 조치 등은 필요하지 않습니다.

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [10월 24, 2024, 10:00오후 UTC](https://meta.discourse.org/t/restore-failing-with-missing-chat-mention-function/331376/33 "2024-10-24T22:00:11Z")

</div>

이 주제는 마지막 답변 후 2일이 지나면 자동으로 닫힙니다. 더 이상 답변을 작성할 수 없습니다.

[이전 페이지](https://meta.discourse.org/t/restore-failing-with-missing-chat-mention-function/331376.md?page=1)
