# Recovering from failed/partially applied upgrade

**URL:** https://meta.discourse.org/t/recovering-from-failed-partially-applied-upgrade/221924
**Category:** Self-hosting
**Created:** [March 24, 2022, 9:25pm UTC](https://meta.discourse.org/t/recovering-from-failed-partially-applied-upgrade/221924 "2022-03-24T21:25:17Z")
**Posts on this page:** 20
**Page:** 2

<div class="post-metadata">

### Author: ![Benjamin\_D](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/benjamin_d/32/277831_2.png) [@Benjamin\_D](https://meta.discourse.org/u/Benjamin_D)
#### Post date: [April 2, 2022, 8:54pm UTC](https://meta.discourse.org/t/recovering-from-failed-partially-applied-upgrade/221924/21 "2022-04-02T20:54:14Z")

</div>

hum… 🤔 that’s weird, I’ve setup a fresh 2.9.0.beta2, commit `5374e587a3`,  
…and rebuild to 2.9.0.beta3 latest (commit `6555f0c11b`) without any issue…

---

<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: [April 2, 2022, 8:57pm UTC](https://meta.discourse.org/t/recovering-from-failed-partially-applied-upgrade/221924/22 "2022-04-02T20:57:47Z")

</div>

Maybe the issue was somewhere before that?

I’m guessing that manually deleting the extra stuff may be the way to go.

---

<div class="post-metadata">

### Author: ![Benjamin\_D](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/benjamin_d/32/277831_2.png) [@Benjamin\_D](https://meta.discourse.org/u/Benjamin_D)
#### Post date: [April 2, 2022, 9:14pm UTC](https://meta.discourse.org/t/recovering-from-failed-partially-applied-upgrade/221924/23 "2022-04-02T21:14:46Z")

</div>

> [@pfaffman](#):
>
> Maybe the issue was somewhere before that?
> 
> I’m guessing that manually deleting the extra stuff may be the way to go.

😩 I have to admit that I don’t fully grasp what’s going on. I’m guessing somehow Nick is missing the `db/post_migrate/20220107014925_drop_bookmark_polymorphic_columns.rb` because of this [commit](https://github.com/discourse/discourse/commit/8040b95e8c4abeab1ab9fe50826f92c52995a814) ?

> [@Nick\_Tomlinson](#):
>
> didn’t work unfortunately, still getting

Was there any output for the drop column commands?

---

<div class="post-metadata">

### Author: ![Nick\_Tomlinson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nick_tomlinson/32/282728_2.png) [@Nick\_Tomlinson](https://meta.discourse.org/u/Nick_Tomlinson)
#### Post date: [April 3, 2022, 10:02am UTC](https://meta.discourse.org/t/recovering-from-failed-partially-applied-upgrade/221924/24 "2022-04-03T10:02:16Z")

</div>

I’ve just tried the commands again and after `./launcher enter app` i get this error

```plaintext
Error response from daemon: Container 69b56d9734c3654d0b0e0661ff612c1020781191d3ec1d866e453747df03fcdf is not running

```

New issue?

---

<div class="post-metadata">

### Author: ![Nick\_Tomlinson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nick_tomlinson/32/282728_2.png) [@Nick\_Tomlinson](https://meta.discourse.org/u/Nick_Tomlinson)
#### Post date: [April 3, 2022, 10:06am UTC](https://meta.discourse.org/t/recovering-from-failed-partially-applied-upgrade/221924/25 "2022-04-03T10:06:28Z")

</div>

Managed to start app with `sudo ./launcher enter app`

This is my input:

```plaintext
root@discourseSwingrz:~# cd /var/discourse
root@discourseSwingrz:/var/discourse# ./launcher enter app
x86_64 arch detected.
Error response from daemon: Container 69b56d9734c3654d0b0e0661ff612c1020781191d3ec1d866e453747df03fcdf is not running
root@discourseSwingrz:/var/discourse# sudo ./launcher start app
x86_64 arch detected.

starting up existing container
+ /usr/bin/docker start app
app
root@discourseSwingrz:/var/discourse# cd /var/discourse
root@discourseSwingrz:/var/discourse# ./launcher enter app
x86_64 arch detected.
root@discourseSwingrz-app:/var/www/discourse# su - postgres
postgres@discourseSwingrz-app:~$ psql
psql (13.2 (Debian 13.2-1.pgdg100+1))
Type "help" for help.

postgres=# ALTER TABLE bookmarks 
postgres-# DROP COLUMN bookmarkable_id
postgres-# DROP COLUMN bookmarkable_type;
ERROR: syntax error at or near "DROP"
LINE 3: DROP COLUMN bookmarkable_type;
        ^
postgres=# 

```

I appreciate all your help with this guys 🙂

---

<div class="post-metadata">

### Author: ![Nick\_Tomlinson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nick_tomlinson/32/282728_2.png) [@Nick\_Tomlinson](https://meta.discourse.org/u/Nick_Tomlinson)
#### Post date: [April 3, 2022, 10:07am UTC](https://meta.discourse.org/t/recovering-from-failed-partially-applied-upgrade/221924/26 "2022-04-03T10:07:15Z")

</div>

Not sure if I’m entering @pfaffman code correctly?

---

<div class="post-metadata">

### Author: ![Benjamin\_D](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/benjamin_d/32/277831_2.png) [@Benjamin\_D](https://meta.discourse.org/u/Benjamin_D)
#### Post date: [April 3, 2022, 10:10am UTC](https://meta.discourse.org/t/recovering-from-failed-partially-applied-upgrade/221924/27 "2022-04-03T10:10:25Z")

</div>

Could you

- make a backup 😅
- try

```plaintext
ALTER TABLE bookmarks 
DROP COLUMN bookmarkable_id;

```

---

<div class="post-metadata">

### Author: ![Nick\_Tomlinson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nick_tomlinson/32/282728_2.png) [@Nick\_Tomlinson](https://meta.discourse.org/u/Nick_Tomlinson)
#### Post date: [April 3, 2022, 10:20am UTC](https://meta.discourse.org/t/recovering-from-failed-partially-applied-upgrade/221924/28 "2022-04-03T10:20:42Z")

</div>

> [@Benjamin\_D](#):
>
> `DROP COLUMN bookmarkable_id;`

like so?

```plaintext
Backup done.
Output file is in: /var/www/discourse/public/backups/default/swingrz-2022-04-03-101750-v20220316150247.tar.gz

root@discourseSwingrz-app:/var/www/discourse# ALTER TABLE bookmarks 
bash: ALTER: command not found
root@discourseSwingrz-app:/var/www/discourse# su - postgres
postgres@discourseSwingrz-app:~$ psql
psql (13.2 (Debian 13.2-1.pgdg100+1))
Type "help" for help.

postgres=# ALTER TABLE bookmarks 
postgres-# DROP COLUMN bookmarkable_id;
ERROR: relation "bookmarks" does not exist
postgres=# 

```

---

<div class="post-metadata">

### Author: ![Benjamin\_D](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/benjamin_d/32/277831_2.png) [@Benjamin\_D](https://meta.discourse.org/u/Benjamin_D)
#### Post date: [April 3, 2022, 10:29am UTC](https://meta.discourse.org/t/recovering-from-failed-partially-applied-upgrade/221924/29 "2022-04-03T10:29:26Z")

</div>

Could you edit your app.yml, uncomment the version line (beware of the indentation) to  
`version: cd7ce52138bed391d5efc56366e7a6517a6079e7`  
and rebuild

---

<div class="post-metadata">

### Author: ![Nick\_Tomlinson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nick_tomlinson/32/282728_2.png) [@Nick\_Tomlinson](https://meta.discourse.org/u/Nick_Tomlinson)
#### Post date: [April 3, 2022, 10:45am UTC](https://meta.discourse.org/t/recovering-from-failed-partially-applied-upgrade/221924/31 "2022-04-03T10:45:18Z")

</div>

Cant seem to find the version line, Ben ?

---

<div class="post-metadata">

### Author: ![Nick\_Tomlinson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nick_tomlinson/32/282728_2.png) [@Nick\_Tomlinson](https://meta.discourse.org/u/Nick_Tomlinson)
#### Post date: [April 3, 2022, 10:46am UTC](https://meta.discourse.org/t/recovering-from-failed-partially-applied-upgrade/221924/32 "2022-04-03T10:46:20Z")

</div>

```plaintext
 ## Which Git revision should this container use? (default: tests-passed)
  #version: tests-passed

```

Is this it?

---

<div class="post-metadata">

### Author: ![Benjamin\_D](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/benjamin_d/32/277831_2.png) [@Benjamin\_D](https://meta.discourse.org/u/Benjamin_D)
#### Post date: [April 3, 2022, 10:49am UTC](https://meta.discourse.org/t/recovering-from-failed-partially-applied-upgrade/221924/33 "2022-04-03T10:49:49Z")

</div>

👍

> <https://github.com/discourse/discourse_docker/blob/e30ccb9042d9952d0cc17a866f67b6d5c1dcbd13/samples/standalone.yml#L37>

---

<div class="post-metadata">

### Author: ![Nick\_Tomlinson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nick_tomlinson/32/282728_2.png) [@Nick\_Tomlinson](https://meta.discourse.org/u/Nick_Tomlinson)
#### Post date: [April 3, 2022, 10:54am UTC](https://meta.discourse.org/t/recovering-from-failed-partially-applied-upgrade/221924/34 "2022-04-03T10:54:58Z")

</div>

> [@Benjamin\_D](#):
>
> version: cd7ce52138bed391d5efc56366e7a6517a6079e7

so replace `#version: tests-passed`

With `version: cd7ce52138bed391d5efc56366e7a6517a6079e7`

Then `/var/discourse/launcher rebuild app`

---

<div class="post-metadata">

### Author: ![Nick\_Tomlinson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nick_tomlinson/32/282728_2.png) [@Nick\_Tomlinson](https://meta.discourse.org/u/Nick_Tomlinson)
#### Post date: [April 3, 2022, 10:58am UTC](https://meta.discourse.org/t/recovering-from-failed-partially-applied-upgrade/221924/35 "2022-04-03T10:58:58Z")

</div>

> [@Benjamin\_D](#):
>
> cd7ce52138bed391d5efc56366e7a6517a6079e7

Just making sure this is correct before i rebuild

```plaintext
  ## Which Git revision should this container use? (default: tests-passed)
  version: cd7ce52138bed391d5efc56366e7a6517a6079e7

```

do i have to indent it again?

```plaintext
(beware of the indentation)

```

Now the code looks like this

```plaintext
## Which Git revision should this container use? (default: tests-passed)
   version: cd7ce52138bed391d5efc56366e7a6517a6079e7

```

Rebuild?

---

<div class="post-metadata">

### Author: ![Benjamin\_D](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/benjamin_d/32/277831_2.png) [@Benjamin\_D](https://meta.discourse.org/u/Benjamin_D)
#### Post date: [April 3, 2022, 11:02am UTC](https://meta.discourse.org/t/recovering-from-failed-partially-applied-upgrade/221924/36 "2022-04-03T11:02:07Z")

</div>

Nope first one is good

---

<div class="post-metadata">

### Author: ![Nick\_Tomlinson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nick_tomlinson/32/282728_2.png) [@Nick\_Tomlinson](https://meta.discourse.org/u/Nick_Tomlinson)
#### Post date: [April 3, 2022, 11:02am UTC](https://meta.discourse.org/t/recovering-from-failed-partially-applied-upgrade/221924/37 "2022-04-03T11:02:30Z")

</div>

thanks, Ben

Will rebuild now

---

<div class="post-metadata">

### Author: ![Benjamin\_D](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/benjamin_d/32/277831_2.png) [@Benjamin\_D](https://meta.discourse.org/u/Benjamin_D)
#### Post date: [April 3, 2022, 11:04am UTC](https://meta.discourse.org/t/recovering-from-failed-partially-applied-upgrade/221924/38 "2022-04-03T11:04:45Z")

</div>

Should be aligned with the #

---

<div class="post-metadata">

### Author: ![Nick\_Tomlinson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nick_tomlinson/32/282728_2.png) [@Nick\_Tomlinson](https://meta.discourse.org/u/Nick_Tomlinson)
#### Post date: [April 3, 2022, 11:05am UTC](https://meta.discourse.org/t/recovering-from-failed-partially-applied-upgrade/221924/39 "2022-04-03T11:05:32Z")

</div>

```plaintext
## Which Git revision should this container use? (default: tests-passed)
version: cd7ce52138bed391d5efc56366e7a6517a6079e7

```

---

<div class="post-metadata">

### Author: ![Benjamin\_D](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/benjamin_d/32/277831_2.png) [@Benjamin\_D](https://meta.discourse.org/u/Benjamin_D)
#### Post date: [April 3, 2022, 11:06am UTC](https://meta.discourse.org/t/recovering-from-failed-partially-applied-upgrade/221924/40 "2022-04-03T11:06:49Z")

</div>

Like your first one:

> [@Nick\_Tomlinson](#):
>
> ```plaintext
> ## Which Git revision should this container use? (default: tests-passed)
> version: cd7ce52138bed391d5efc56366e7
> 
> ```

---

<div class="post-metadata">

### Author: ![Nick\_Tomlinson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nick_tomlinson/32/282728_2.png) [@Nick\_Tomlinson](https://meta.discourse.org/u/Nick_Tomlinson)
#### Post date: [April 3, 2022, 12:20pm UTC](https://meta.discourse.org/t/recovering-from-failed-partially-applied-upgrade/221924/41 "2022-04-03T12:20:41Z")

</div>

Ben, It worked! 😁

**Thank you so much for your time & effort in assisting me!**

(please PM me so i can send you some coffee or beer money)

[Previous page](https://meta.discourse.org/t/recovering-from-failed-partially-applied-upgrade/221924.md?page=1)

[Next page](https://meta.discourse.org/t/recovering-from-failed-partially-applied-upgrade/221924.md?page=3)
