[SOLVED] Upgrade from 2.1.0 to 3.0.3 failed

Now I’m trying to upgrade Mattermost Team Edition from 2.1.0 to 3.0.3 while referring to Upgrade Guide,
and I have this error when executing ./platform -upgrade_db_30

[2016/10/28 13:28:06 JST] [EROR] Failed to load team membership details=SqlTeamStore.GetMembers: store.sql_team.get_members.app_error, teamId=4dp98jsagiru8rbgqf3wehhh8o gorp: no fields [deleteat] in type TeamMember

I checked DB and found this is because there are no records on TeamMembers table.
How shoud I do to add any records to TeamMembers table?

Thanks a lot.

Hmm…something is strange. TeamMember table was added in 3.0 so not sure why it would be attempt to load from the table during the upgrade process.

Can you share more information about your enviroment? Platform and version? DB and version? Any other info in the mattermost logs? or a larger snippet of the mattermost log?

Thank you for the reply.
My environment is Windows Server 2008 and Mattermost runs on the guest OS(Cent OS 7.2) with Vagrant.
I installed 2.1.0 by this script, so DB is mysql 5.7.

I couldn’t find any other unusual logs.
The entire log is below. Sorry for the logs in Japanese.

>./platform
[2016/10/26 13:56:47 JST] [INFO] 現在のバージョンは3.0.0 (3.0.3/Fri May 27 18:08:10 UTC 2016/cb745475452a9fc8ef3a9fedf6b34af7d05adba9)です
[2016/10/26 13:56:47 JST] [INFO] エンタープライズが有効: false
[2016/10/26 13:56:47 JST] [INFO] 現在のワーキングディレクトリーは/opt/mattermost/binです
[2016/10/26 13:56:47 JST] [INFO] /opt/mattermost/config/config.jsonから設定ファイルを読み込んでいます
[2016/10/26 13:56:47 JST] [INFO] サーバーが初期化中です…
[2016/10/26 13:56:47 JST] [INFO] SQLmasterデータベースからの応答を確認中です
[2016/10/26 13:56:47 JST] [INFO] SQLreplica-0データベースからの応答を確認中です
[2016/10/26 13:56:47 JST] [WARN] 2.1.0のデータベーススキーマのバージョンは古くなっています
[2016/10/26 13:56:47 JST] [WARN] データベーススキームのバージョンを3.0.0にアップグレードしようとしています
[2016/10/26 13:56:47 JST] [CRIT] The database version of 2.1.0 cannot be automatically upgraded to 3.0 schema
[2016/10/26 13:56:47 JST] [CRIT] You will need to run the command line tool './platform -upgrade_db_30'
[2016/10/26 13:56:47 JST] [CRIT] Please see 'http://www.mattermost.org/upgrade-to-3-0/' for more information on how to upgrade.

>./platform -upgrade_db_30
[2016/10/28 13:28:01 JST] [INFO] 現在のバージョンは3.0.0 (3.0.3/Fri May 27 18:08:10 UTC 2016/cb745475452a9fc8ef3a9fedf6b34af7d05adba9)です
[2016/10/28 13:28:01 JST] [INFO] エンタープライズが有効: false
[2016/10/28 13:28:01 JST] [INFO] 現在のワーキングディレクトリーは/opt/mattermost3.0.3/binです
[2016/10/28 13:28:01 JST] [INFO] /opt/mattermost3.0.3/config/config.jsonから設定ファイルを読み込んでいます
[2016/10/28 13:28:01 JST] [INFO] SQLmasterデータベースからの応答を確認中です
[2016/10/28 13:28:01 JST] [INFO] SQLreplica-0データベースからの応答を確認中です
[2016/10/28 13:28:01 JST] [INFO] Attempting to run speical upgrade of the database schema to version 3.0 for user model changes
[2016/10/28 13:28:06 JST] [INFO] Starting speical 3.0 database upgrade with performed_backup=YES team_name=med
[2016/10/28 13:28:06 JST] [INFO] Primary team med will be left unchanged
[2016/10/28 13:28:06 JST] [INFO] Upgrading primary team med
[2016/10/28 13:28:06 JST] [EROR] Failed to load team membership details=SqlTeamStore.GetMembers: store.sql_team.get_members.app_error, teamId=4dp98jsagiru8rbgqf3wehhh8o gorp: no fields [deleteat] in type TeamMember

hmm…still not sure what’s happening. Maybe try upgrading to 2.2 first then to 3.0.3?

upgrading from 2.1 to 2.2 has been successful,
but 2.2 to 3.0.3 failed for the same reason.

All the tables of Mattermost 2.2 DB are below.

+----------------------+
| Tables_in_mattermost |
+----------------------+
| Audits               |
| ChannelMembers       |
| Channels             |
| Commands             |
| Compliances          |
| Emoji                |
| IncomingWebhooks     |
| Licenses             |
| OAuthAccessData      |
| OAuthApps            |
| OAuthAuthData        |
| OutgoingWebhooks     |
| PasswordRecovery     |
| Posts                |
| Preferences          |
| Sessions             |
| Status               |
| Systems              |
| TeamMembers          |
| Teams                |
| Users                |
+----------------------+
21 rows in set (0.00 sec)

I found Several tables(Commands, Compliances, Emoji, Status, TeamMembers, etc.) were empty.
This consitution isn’t normal?

Can you send a screenshot of the TeamMembers Table. Are you running MySQL or Postgres? The weird thing is that it’s failing on the column named deleteat which for MySQL should be cased like DeleteAt vs the lowercasing which is for a Postgres Database.

I’m running MySQL.

mysql> select * from TeamMembers;
Empty set (0.00 sec)

mysql> show columns from TeamMembers;
+----------+-------------+------+-----+---------+-------+
| Field    | Type        | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| TeamId   | varchar(26) | NO   | PRI | NULL    |       |
| UserId   | varchar(26) | NO   | PRI | NULL    |       |
| Roles    | varchar(64) | YES  |     | NULL    |       |
| DeleteAt | bigint(20)  | YES  |     | NULL    |       |
+----------+-------------+------+-----+---------+-------+
4 rows in set (0.01 sec)

I gave up upgrading and created a new one.
Thanks.

I had the same problem. My database version was 2.0.2 the table teammembers was there and empty. I dropped the table teammembers, and started the upgrade process by using version 3.0.3 again. It worked.

I did two things:

  • I filled the TeamMembers table with the contents from:
    SELECT Users.TeamId, Users.Id, Users.Roles WHERE Users.TeamId = $HERE_COMES_THE_TEAM_ID_THAT_THE_UPGRADE_PROCESS_COMPLAINS_ABOUT
  • I set DeleteAT for every entry in the TeamMembers table to 0 (zero)
  • ALTER TABLE TeamMembers DROP COLUMN DeleteAt

I’m not sure the first step was necessary, however, after that the upgrade command worked.