summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-03-13 14:10:55 +0000
committerRémy Coutable <remy@rymai.me>2017-03-13 14:10:55 +0000
commite316958f72217191dda12eee497e8141b711f28c (patch)
tree00d1d287fe9a43d1ea3120c93953afdc61a61068
parent32da7602686f2b8161175d82b121deb9e01b2db5 (diff)
parentdbf414df33160b8ca15650c56bab9e9b3f2d0ccf (diff)
downloadgitlab-ce-e316958f72217191dda12eee497e8141b711f28c.tar.gz
Merge branch 'refresh-permissions-recent-users' into 'master'
Trigger refreshing of permissions in a migration See merge request !8914
-rw-r--r--changelogs/unreleased/refresh-permissions-recent-users.yml4
-rw-r--r--db/post_migrate/20170131214021_reset_users_authorized_projects_populated.rb19
2 files changed, 23 insertions, 0 deletions
diff --git a/changelogs/unreleased/refresh-permissions-recent-users.yml b/changelogs/unreleased/refresh-permissions-recent-users.yml
new file mode 100644
index 00000000000..4d08be6ed5c
--- /dev/null
+++ b/changelogs/unreleased/refresh-permissions-recent-users.yml
@@ -0,0 +1,4 @@
+---
+title: Reset users.authorized_projects_populated to automatically refresh user permissions
+merge_request:
+author:
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