# ユーザーの投稿を削除できません: InvalidForeignKey

**URL:** <https://meta.discourse.org/t/cant-delete-a-users-posts-invalidforeignkey/398175>\
**Category:** Support\
**Created:** [2026 年 3 月 11 日午後 2:53 UTC](https://meta.discourse.org/t/cant-delete-a-users-posts-invalidforeignkey/398175 "2026-03-11T14:53:59Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)\
**Post date:** [2026 年 3 月 11 日午後 2:53 UTC](https://meta.discourse.org/t/cant-delete-a-users-posts-invalidforeignkey/398175/1 "2026-03-11T14:53:59Z")

</div>

ユーザーの投稿の削除を試行しました。

投稿が削除されなかったため、Sidekiqと`/logs`を確認したところ、削除プロセスでエラーが返されました。

```plaintext
Job exception: PG::ForeignKeyViolation: ERROR: update or delete on table "reviewables" violates foreign key constraint "fk_rails_2fe5fa5cd0" on table "reviewable_notes"
DETAIL: Key (id)=(7870) is still referenced from table "reviewable_notes".

```

このレビュー可能なアイテムは15日前に承認されており、実際に関連付けられているノートが3つあります。

フラグID 7870を作成したユーザーは、投稿を削除しようとしているユーザーと同じであり、これが問題の原因だと推測されます。

しかし、このエラーを解消し、ユーザーのアカウントを削除するにはどうすればよいでしょうか？

---

_[View the full topic](https://meta.discourse.org/t/cant-delete-a-users-posts-invalidforeignkey/398175)._
