Database Table Field Missing after upgrade

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

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

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;)

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

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”

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”}

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:

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).

Thank you agriesser !
I run the following query

DELETE FROM db_migrations WHERE version > 72;

then restart the mattermost and it work well

Thanks for autocorrecting my typo :confused: I already fixed it in my posting, sorry, shouldn’t happen :frowning:

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