MM-25507: Remove old migration state marker before running fresh migration (#14768)

While resetting permissions, we were not removing old migration state residue
for the EMOJIS_PERMISSIONS_MIGRATION_KEY and GUEST_ROLES_CREATION_MIGRATION_KEY.
Therefore, during their migration, they got skipped because the code checks
if a migration key is already present or not.

To fix this, we remove the migration key just as we do for ADVANCED_PERMISSIONS_MIGRATION_KEY.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Agniva De Sarker
2020-06-25 13:36:47 +05:30
коммит произвёл GitHub
родитель 23e306bc3a
Коммит 1648b11e82
3 изменённых файлов: 36 добавлений и 2 удалений

Просмотреть файл

@@ -134,8 +134,11 @@ func (a *App) DoEmojisPermissionsMigration() {
return
}
systemAdminRole.Permissions = append(systemAdminRole.Permissions, model.PERMISSION_CREATE_EMOJIS.Id, model.PERMISSION_DELETE_EMOJIS.Id)
systemAdminRole.Permissions = append(systemAdminRole.Permissions, model.PERMISSION_DELETE_OTHERS_EMOJIS.Id)
systemAdminRole.Permissions = append(systemAdminRole.Permissions,
model.PERMISSION_CREATE_EMOJIS.Id,
model.PERMISSION_DELETE_EMOJIS.Id,
model.PERMISSION_DELETE_OTHERS_EMOJIS.Id,
)
if _, err := a.Srv().Store.Role().Save(systemAdminRole); err != nil {
mlog.Critical("Failed to migrate emojis creation permissions from mattermost config.", mlog.Err(err))
return