# Plugin causing errors during rebuild

**URL:** <https://meta.discourse.org/t/plugin-causing-errors-during-rebuild/241110>\
**Category:** Self-hosting\
**Created:** [October 6, 2022, 9:35am UTC](https://meta.discourse.org/t/plugin-causing-errors-during-rebuild/241110 "2022-10-06T09:35:29Z")\
**Posts on this page:** 1\
**Showing post:** 24

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [October 6, 2022, 8:35pm UTC](https://meta.discourse.org/t/plugin-causing-errors-during-rebuild/241110/24 "2022-10-06T20:35:47Z")

</div>

> [@angus](#):
>
> I’ll respectfully disagree with you there

Well, I mostly defer to you on this, and I think we really agree. I think it’s true that the migration works if the data aren’t broken. We agree that if the data are broken it should fail more gracefully that it does now.

> [@Jaap-Jan\_Swijnenburg](#):
>
> At least every month, we run our updates, so it’s not like there is a huge gap between versions.

Yes, but the data likely were corrupted years ago (that’s the case on the site that I am familiar with), but you didn’t notice because it didn’t fail catastrophically. I’m pretty sure that it wasn’t managing the upvotes as expected, but no one noticed.

> [@Jaap-Jan\_Swijnenburg](#):
>
> How would I be able to connect to the Discourse DB myself, to verify what’s in the post\_custom\_fields table?

I’d do it from rails, something like this:

```plaintext
./launcher enter app
rails c

```

Then stuff like this:

```plaintext
all_votes=PostCustomField.where(name: "vote_history")
likely_broken_votes=PostCustomField.where(name: "vote_history").where("value like '\"%'")

```

Look at just the id and data:

```plaintext
all_votes.pluck(:id,:value)

```

Get just one pcf:

```plaintext
pcf=PostCustomField.find(1234)

```

Fix it

```plaintext
pcf.value='the stuff you really want in it'
pcf.save

```

---

_[View the full topic](https://meta.discourse.org/t/plugin-causing-errors-during-rebuild/241110)._
