# Herbouwen mislukt op db:migrate met PG12

**URL:** https://meta.discourse.org/t/rebuild-fails-on-db-migrate-w-pg12/224287
**Category:** Self-hosting
**Created:** [14 april 2022 om 15:25 UTC](https://meta.discourse.org/t/rebuild-fails-on-db-migrate-w-pg12/224287 "2022-04-14T15:25:57Z")
**Posts on this page:** 1
**Showing post:** 22

<div class="post-metadata">

### Author: ![Iceman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/iceman/32/181309_2.png) [@Iceman](https://meta.discourse.org/u/Iceman)
#### Post date: [8 mei 2022 om 10:31 UTC](https://meta.discourse.org/t/rebuild-fails-on-db-migrate-w-pg12/224287/22 "2022-05-08T10:31:20Z")

</div>

I’m pretty much in “limbo” right now. Tried your suggestion with PG12 and “Stable”. It doesn’t work, the restore just stops. So I’m wiping the machine once again to try again fresh because now it won’t do app rebuild.

While that machine is trying to “go back to PG12” I’m trying to see if I can move forward on the other: If I try to upgrade PG with a fresh install it dies after `Creating missing functions in the discourse_functions schema...` (starts returning 500) and `tail -f shared/data/log/var-log/postgres/current` shows that the data container is “moving”, although just full of “errors” such as this:

```plaintext
discourse@discourse ERROR: relation "user_auth_tokens" does not exist at character 34
discourse@discourse STATEMENT: SELECT "user_auth_tokens".* FROM "user_auth_tokens" WHERE ((auth_token = 'XXXX=' OR
                                  prev_auth_token = 'XXXX=') AND rotated_at > '2022-03-09 10:21:44.051357') LIMIT 1

```

```plaintext
discourse@discourse ERROR: relation "application_requests" does not exist at character 41
discourse@discourse STATEMENT: SELECT "application_requests"."id" FROM "application_requests" WHERE "application_requests"."date" = '2022-05-08' AND "application_requests"."req_type" = 0 LIMIT 1

```

However, Discourse may be dead but the machine **Is** being used, so… is it working but it just takes hours and hours? Because I let it roll for 1h+ and nothing changed.

At this point I’m already thinking if this shouldn’t go [here](https://meta.discourse.org/t/postgresql-13-update/172563), lol.

PD: I tried 2 different backups, since I took 2 before the adventure.

---

_[View the full topic](https://meta.discourse.org/t/rebuild-fails-on-db-migrate-w-pg12/224287)._
