# データベース破損により多数のユーザーが破損

**URL:** <https://meta.discourse.org/t/so-many-broken-users-due-to-corrupt-database/135779>\
**Category:** Product Support\
**Created:** [2019 年 12 月 12 日午後 4:32 UTC](https://meta.discourse.org/t/so-many-broken-users-due-to-corrupt-database/135779 "2019-12-12T16:32:12Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)\
**Post date:** [2020 年 4 月 27 日午前 7:23 UTC](https://meta.discourse.org/t/so-many-broken-users-due-to-corrupt-database/135779/16 "2020-04-27T07:23:37Z")

</div>

おっしゃる通りです。テーブル名を変更した後、制約を再作成する必要があったことを確かに覚えております。  
この重要な見落としについてお詫び申し上げます。

私のメモによると：

```
alter table poll_votes drop constraint fk_rails_b64de9b025;
alter table poll_votes add constraint fk_rails_b64de9b025 FOREIGN KEY (user_id) REFERENCES users(id);

alter table user_security_keys drop constraint fk_rails_90999b0454;
alter table user_security_keys add constraint fk_rails_90999b0454 FOREIGN KEY (user_id) REFERENCES users(id);

```

そして現在では、以下も必要です：

```
alter table bookmarks drop constraint fk_rails_c1ff6fa4ac;
alter table bookmarks add constraint fk_rails_c1ff6fa4ac FOREIGN KEY (user_id) REFERENCES users(id);

```

重要な免責事項として： **これを適用するのは、自分が何をしているかを完全に理解している場合に限ってください** ！

---

_[View the full topic](https://meta.discourse.org/t/so-many-broken-users-due-to-corrupt-database/135779)._
