summaryrefslogtreecommitdiffstats
path: root/store/sqlstore/upgrade.go
diff options
context:
space:
mode:
Diffstat (limited to 'store/sqlstore/upgrade.go')
-rw-r--r--store/sqlstore/upgrade.go21
1 files changed, 16 insertions, 5 deletions
diff --git a/store/sqlstore/upgrade.go b/store/sqlstore/upgrade.go
index fc2d53235..868575522 100644
--- a/store/sqlstore/upgrade.go
+++ b/store/sqlstore/upgrade.go
@@ -431,6 +431,19 @@ func UpgradeDatabaseToVersion50(sqlStore SqlStore) {
// in `config.json` to a `Permission` in the database. The migration code can be seen
// in the file `app/app.go` in the function `DoEmojisPermissionsMigration()`.
+ // This version of Mattermost also includes a online-migration which migrates some roles from the `Roles` columns of
+ // TeamMember and ChannelMember rows to the new SchemeAdmin and SchemeUser columns. If you need to downgrade to a
+ // version of Mattermost prior to 5.0, you should take your server offline and run the following SQL statements
+ // prior to launching the downgraded version:
+ //
+ // UPDATE Teams SET SchemeId = NULL;
+ // UPDATE Channels SET SchemeId = NULL;
+ // UPDATE TeamMembers SET Roles = CONCAT(Roles, ' team_user'), SchemeUser = NULL where SchemeUser = 1;
+ // UPDATE TeamMembers SET Roles = CONCAT(Roles, ' team_admin'), SchemeAdmin = NULL where SchemeAdmin = 1;
+ // UPDATE ChannelMembers SET Roles = CONCAT(Roles, ' channel_user'), SchemeUser = NULL where SchemeUser = 1;
+ // UPDATE ChannelMembers SET Roles = CONCAT(Roles, ' channel_admin'), SchemeAdmin = NULL where SchemeAdmin = 1;
+ // DELETE from Systems WHERE Name = 'migration_advanced_permissions_phase_2';
+
if shouldPerformUpgrade(sqlStore, VERSION_4_10_0, VERSION_5_0_0) {
sqlStore.CreateColumnIfNotExistsNoDefault("Teams", "SchemeId", "varchar(26)", "varchar(26)")
@@ -453,9 +466,7 @@ func UpgradeDatabaseToVersion50(sqlStore SqlStore) {
}
func UpgradeDatabaseToVersion51(sqlStore SqlStore) {
- // TODO: Uncomment following condition when version 5.1.0 is released
- // if shouldPerformUpgrade(sqlStore, VERSION_5_0_0, VERSION_5_1_0) {
-
- // saveSchemaVersion(sqlStore, VERSION_5_1_0)
- // }
+ if shouldPerformUpgrade(sqlStore, VERSION_5_0_0, VERSION_5_1_0) {
+ saveSchemaVersion(sqlStore, VERSION_5_1_0)
+ }
}