# Database Table Field Missing after upgrade

**URL:** <https://forum.mattermost.com/t/database-table-field-missing-after-upgrade/13629>\
**Category:** Troubleshooting\
**Created:** [July 5, 2022, 7:20am UTC](https://forum.mattermost.com/t/database-table-field-missing-after-upgrade/13629 "2022-07-05T07:20:34Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![reyas](https://avatars.discourse-cdn.com/v4/letter/r/898d66/32.png) [@reyas](https://forum.mattermost.com/u/reyas)\
**Post date:** [July 5, 2022, 7:20am UTC](https://forum.mattermost.com/t/database-table-field-missing-after-upgrade/13629/1 "2022-07-05T07:20:34Z")

</div>

Hi,  
Mattermost is upgraded to version 7.0.0 and after upgradation i am seeing many issues with the fields missing the the database tables as “Unknown column ‘ThreadDeleteAt’ in 'field list” , when searched on for the db structure unable to find the solution for this , so kindly help to fix this issue

---

<div class="post-metadata">

**Author:** ![agnivade](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/agnivade/32/3846_2.png) [@agnivade](https://forum.mattermost.com/u/agnivade)\
**Post date:** [July 5, 2022, 9:09am UTC](https://forum.mattermost.com/t/database-table-field-missing-after-upgrade/13629/2 "2022-07-05T09:09:31Z")

</div>

@isacikgoz - would you be able to help out here?

---

<div class="post-metadata">

**Author:** ![isacikgoz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/isacikgoz/32/4554_2.png) [@isacikgoz](https://forum.mattermost.com/u/isacikgoz)\
**Post date:** [July 5, 2022, 9:25am UTC](https://forum.mattermost.com/t/database-table-field-missing-after-upgrade/13629/3 "2022-07-05T09:25:56Z")

</div>

Hey @reyas could you provide following questions to help us understand the issue:

- Which version were you using before upgrading to a newer one?
- What type of DB do you use and which version?
- Could you share the logs after you migrated to a newer version? Or the current error logs.
- Can you share the contents of `db_migrations` table? (You can run `SELECT * FROM db_migrations;`)

---

<div class="post-metadata">

**Author:** ![reyas](https://avatars.discourse-cdn.com/v4/letter/r/898d66/32.png) [@reyas](https://forum.mattermost.com/u/reyas)\
**Post date:** [July 5, 2022, 12:19pm UTC](https://forum.mattermost.com/t/database-table-field-missing-after-upgrade/13629/4 "2022-07-05T12:19:44Z")

</div>

Have fixed the issue with the ALTER table command on the missing and now its working

---

<div class="post-metadata">

**Author:** ![Erwan](https://avatars.discourse-cdn.com/v4/letter/e/b4bc9f/32.png) [@Erwan](https://forum.mattermost.com/u/Erwan)\
**Post date:** [August 10, 2022, 12:43pm UTC](https://forum.mattermost.com/t/database-table-field-missing-after-upgrade/13629/5 "2022-08-10T12:43:56Z")

</div>

Hi,  
I have the same issue after a migration from 6.3.9 to 7.1.2  
and with the jira plugin in version 3.2.0.  
When I create a jira issue from a post I got the following error :  
failed to create notification post du4wokcnujn1zrukgn736atmhy: CreatePost: Unable to save the Post., update thread from posts failed: pq: column threads.threaddeleteat does not exist

I create the missing column and it work well

Here is the content of the db\_migration table :  
1,“create\_teams”  
2,“create\_team\_members”  
3,“create\_cluster\_discovery”  
4,“create\_command\_webhooks”  
5,“create\_compliances”  
6,“create\_emojis”  
7,“create\_user\_groups”  
8,“create\_group\_members”  
9,“create\_group\_teams”  
10,“create\_group\_channels”  
11,“create\_link\_metadata”  
12,“create\_commands”  
13,“create\_incoming\_webhooks”  
14,“create\_outgoing\_webhooks”  
15,“create\_systems”  
16,“create\_reactions”  
17,“create\_roles”  
18,“create\_schemes”  
19,“create\_licenses”  
20,“create\_posts”  
21,“create\_product\_notice\_view\_state”  
22,“create\_sessions”  
23,“create\_terms\_of\_service”  
24,“create\_audits”  
25,“create\_oauth\_access\_data”  
26,“create\_preferences”  
27,“create\_status”  
28,“create\_tokens”  
29,“create\_bots”  
30,“create\_user\_access\_tokens”  
31,“create\_remote\_clusters”  
32,“create\_sharedchannels”  
33,“create\_sidebar\_channels”  
34,“create\_oauthauthdata”  
35,“create\_sharedchannelattachments”  
36,“create\_sharedchannelusers”  
37,“create\_sharedchannelremotes”  
38,“create\_jobs”  
39,“create\_channel\_member\_history”  
40,“create\_sidebar\_categories”  
41,“create\_upload\_sessions”  
42,“create\_threads”  
43,“thread\_memberships”  
44,“create\_user\_terms\_of\_service”  
45,“create\_plugin\_key\_value\_store”  
46,“create\_users”  
47,“create\_file\_info”  
48,“create\_oauth\_apps”  
49,“create\_channels”  
50,“create\_channelmembers”  
51,“create\_msg\_root\_count”  
52,“create\_public\_channels”  
53,“create\_retention\_policies”  
54,“create\_crt\_channelmembership\_count”  
55,“create\_crt\_thread\_count\_and\_unreads”  
56,“upgrade\_channels\_v6.0”  
57,“upgrade\_command\_webhooks\_v6.0”  
58,“upgrade\_channelmembers\_v6.0”  
59,“upgrade\_users\_v6.0”  
60,“upgrade\_jobs\_v6.0”  
61,“upgrade\_link\_metadata\_v6.0”  
62,“upgrade\_sessions\_v6.0”  
63,“upgrade\_threads\_v6.0”  
64,“upgrade\_status\_v6.0”  
65,“upgrade\_groupchannels\_v6.0”  
66,“upgrade\_posts\_v6.0”  
67,“upgrade\_channelmembers\_v6.1”  
68,“upgrade\_teammembers\_v6.1”  
69,“upgrade\_jobs\_v6.1”  
70,“upgrade\_cte\_v6.1”  
71,“upgrade\_sessions\_v6.1”  
72,“upgrade\_schemes\_v6.3”  
73,“upgrade\_plugin\_key\_value\_store\_v6.3”  
74,“upgrade\_users\_v6.3”  
75,“alter\_upload\_sessions\_index”  
76,“upgrade\_lastrootpostat”  
77,“upgrade\_users\_v6.5”  
78,“create\_oauth\_mattermost\_app\_id”  
79,“usergroups\_displayname\_index”  
80,“posts\_createat\_id”  
81,“threads\_deleteat”  
82,“upgrade\_oauth\_mattermost\_app\_id”  
83,“threads\_threaddeleteat”  
84,“recent\_searches”  
85,“fileinfo\_add\_archived\_column”  
86,“add\_cloud\_limits\_archived”  
87,“sidebar\_categories\_index”  
88,“remaining\_migrations”  
89,“add-channelid-to-reaction”

---

<div class="post-metadata">

**Author:** ![Erwan](https://avatars.discourse-cdn.com/v4/letter/e/b4bc9f/32.png) [@Erwan](https://forum.mattermost.com/u/Erwan)\
**Post date:** [August 10, 2022, 1:15pm UTC](https://forum.mattermost.com/t/database-table-field-missing-after-upgrade/13629/6 "2022-08-10T13:15:43Z")

</div>

I have also an issue when soft deleting a team from api

mattermost-team-edition {“timestamp”:“2022-08-10 13:15:05.692 Z”,“level”:“error”,“msg”:“We encountered an error updating the team.”,“caller”:“web/context.go:105”,“path”:“/api/v4/teams/omxmci7d37g73dwsddfreup4yy”,“request\_id”:“sk9wk6drc7y79x9sc5h9zsq5pa”,“ip\_addr”: ││ “19.0.64.0”,“user\_id”:“7wwr7nqgkbgi8bie986uqmizhw”,“method”:“DELETE”,“err\_where”:“SoftDeleteTeam”,“http\_code”:500,“err\_details”:“failed to update Team with id=omxmci7d37g73dwsddfreup4yy: pq: column "cloudlimitsarchived" of relation "teams" does not exist”}

---

<div class="post-metadata">

**Author:** ![agriesser](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/agriesser/32/5644_2.png) [@agriesser](https://forum.mattermost.com/u/agriesser)\
**Post date:** [August 10, 2022, 2:36pm UTC](https://forum.mattermost.com/t/database-table-field-missing-after-upgrade/13629/7 "2022-08-10T14:36:41Z")

</div>

Hi Erwan and welcome to the Mattermost Forums!

It looks as if some of your DB migrations weren’t applied properly, although the system thinks they are.  
To have the system try the failed migrations again, we need to first find out what migrations you’re missing, but let’s assume that everything up to 6.3 was working fine, so you can delete all the records below ID 72 to see if that helps.

To do that, shut down your mattermost instance and then connect to the database and run the following query:

```sql
DELETE FROM db_migrations WHERE version > 71;

```

Then start the mattermost instance again and watch the output in `mattermost.log` - you should see the system trying to run the migrations again. If there are any errors, please post them in your next reply.

If everything worked, you will still see version 89 in your `db_migrations` table and you will also see the missing columns (f.ex. `threaddeleteat` in the threads table).

---

<div class="post-metadata">

**Author:** ![Erwan](https://avatars.discourse-cdn.com/v4/letter/e/b4bc9f/32.png) [@Erwan](https://forum.mattermost.com/u/Erwan)\
**Post date:** [August 10, 2022, 3:09pm UTC](https://forum.mattermost.com/t/database-table-field-missing-after-upgrade/13629/8 "2022-08-10T15:09:07Z")

</div>

Thank you agriesser !  
I run the following query

```auto
DELETE FROM db_migrations WHERE version > 72;

```

then restart the mattermost and it work well

---

<div class="post-metadata">

**Author:** ![agriesser](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/agriesser/32/5644_2.png) [@agriesser](https://forum.mattermost.com/u/agriesser)\
**Post date:** [August 10, 2022, 3:10pm UTC](https://forum.mattermost.com/t/database-table-field-missing-after-upgrade/13629/9 "2022-08-10T15:10:43Z")

</div>

Thanks for autocorrecting my typo 😕 I already fixed it in my posting, sorry, shouldn’t happen ☹

So the error messages are gone for you and the system is working again?
