Mattermost files uploads no longer work after 7.0.2

Summary
Since version 7.0.2 any file uploads do not show for the other user, just get a big blank box after the text .

Steps to reproduce
create a message and attach a file or image and post

Expected behavior
other user should see the file to open or download

Observed behavior
other users never see the file

{“level”:“debug”,“msg”:“Received HTTP request”,“fields”:{“method”:“POST”,“request_id”:“4i6wgmjhc7g5j8nqsio5dtsbxy”,“status_code”:“200”,“url”:“/api/v4/channels/members/me/view”}}
{“level”:“debug”,“msg”:“Scheduling Job”,“fields”:{“scheduler”:“migrations”}}
{“level”:“debug”,“msg”:“All migrations are complete.”,“fields”:{“scheduler”:“migrations”}}
{“level”:“debug”,“msg”:“Next run time for scheduler”,“fields”:{“next_runtime”:“"\u003cnil\u003e"”,“scheduler_name”:“migrations”}}
{“level”:“debug”,“msg”:“Received HTTP request”,“fields”:{“method”:“POST”,“request_id”:“6twozcj5ijnbjf37zfoqrz3awo”,“status_code”:“200”,“url”:“/api/v4/channels/members/me/view”}}
{“level”:“debug”,“msg”:“Received HTTP request”,“fields”:{“method”:“POST”,“request_id”:“ki59gt71hpgyxm3w3q8qg4tcgw”,“status_code”:“200”,“url”:“/api/v4/channels/members/me/view”}}
{“level”:“debug”,“msg”:“Received HTTP request”,“fields”:{“method”:“POST”,“request_id”:“rq6uzrk5atyuxksemx1pzcrrto”,“status_code”:“200”,“url”:“/api/v4/channels/members/me/view”}}
{“level”:“debug”,“msg”:“Received HTTP request”,“fields”:{“method”:“POST”,“request_id”:“czun6zd1nbnd8cztuhyw36dcgc”,“status_code”:“201”,“url”:“/api/v4/files”}}
{“level”:“warn”,“msg”:“Failed to invalidate the fileInfo cache.”,“fields”:{“error”:“"failed to get FileInfo with id=3xer9ogn73g7mep1bm5uzr6bdh: Error 1054: Unknown column ‘FileInfo.Archived’ in ‘field list’"”,“file_info_id”:“3xer9ogn73g7mep1bm5uzr6bdh”}}

I can see the file on the server . I do not see the FileInfo.Archived filed in the database
I also see this in the logs {“level”:“fatal”,“msg”:“Failed to apply database migrations.”,“fields”:{“error”:“"open migrations\mysql: file does not exist"”}}

Hi,

can you provde some additional information about your deployment, please? Is this a custom build or an official one and what’s the platform you’re running on? Could it be that this is a windows host? If so I’m sorry to say that but Windows is not officially supported as a host platform.

Your database is clearly missing some migrations as you’ve seen, so in order to find out at what migration version you are, please run the following SQL query:

select max(Version) from db_migrations;

This command will return a number. Mattermost 7.0.2 was running on version 85, so if this is the number you’re seeing here, then none of the migrations after 7.0.2 have been applied. If you upgraded to 7.5.1 now, you need to manually run the migrations for this release. To do that, make sure your Mattermost application server is stopped and get a list of the SQL files by browsing the mattermost server code at GitHub for the release you’re running. I’m assuming you tried to install 7.5.1 now, if this assumption is not correct, please just replace the version in the URL:

You can see that 7.5.1’s max migration version is 95, so assuming that you’re on 85, you need to manually upgrade the versions 86 to 95.
You’re interested in the .up.sql files (because you want to upgrade your server to the new schema), so looking at the migration with ID 86, you can just copy and paste what you see here into your MySQL console to manually apply this migration:

Continue until you reach the highest version necessary for the release you installed.
When all migrations applied successfully without error messages, you can start the application server again and it should work again. If there are any error during the migrations or if it still doesn’t work then, please post logs and error messages again.

@agriesser

Ok so i am running 7.2.1 and the schema version was at 77.

So I ran the up migration files up to 90 all worked and that actually took care of the file upload issue. But looks like the db_migrations db does not get updated doing them manually do I need to update the migrations db to 90 so it does not try and run migrations when service is started

Yes, you could do that manually. These are the contents of this table on one of my demo systems, please insert the values according to the max supported version of the installed mattermost version:

mysql> select * from db_migrations where Version > 77;
+---------+---------------------------------+
| Version | Name                            |
+---------+---------------------------------+
|      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       |
|      90 | create_enums                    |
|      91 | create_post_reminder            |
|      92 | add_createat_to_teammembers     |
|      93 | notify_admin                    |
+---------+---------------------------------+
16 rows in set (0.00 sec)