diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2017-01-31 22:44:31 +0100 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2017-03-13 13:28:26 +0100 |
commit | dbf414df33160b8ca15650c56bab9e9b3f2d0ccf (patch) | |
tree | 00d1d287fe9a43d1ea3120c93953afdc61a61068 /db | |
parent | 32da7602686f2b8161175d82b121deb9e01b2db5 (diff) | |
download | gitlab-ce-dbf414df33160b8ca15650c56bab9e9b3f2d0ccf.tar.gz |
Trigger refreshing of permissions in a migrationrefresh-permissions-recent-users
This migration resets `users.authorized_projects_populated` (in batches)
so that active users' permissions are refreshed on the next request.
This ensures that their permissions are properly stored.
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20170131214021_reset_users_authorized_projects_populated.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/db/post_migrate/20170131214021_reset_users_authorized_projects_populated.rb b/db/post_migrate/20170131214021_reset_users_authorized_projects_populated.rb new file mode 100644 index 00000000000..b518038e93a --- /dev/null +++ b/db/post_migrate/20170131214021_reset_users_authorized_projects_populated.rb @@ -0,0 +1,19 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class ResetUsersAuthorizedProjectsPopulated < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + # This ensures we don't lock all users for the duration of the migration. + update_column_in_batches(:users, :authorized_projects_populated, nil) + end + + def down + # noop + end +end |