diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-06-22 15:05:52 +0200 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-06-22 15:05:52 +0200 |
commit | 97c42df3b804a37e659c3cda6bd8a52570f31366 (patch) | |
tree | 97c38db7f71a93a7b0db5ca2c682d6d17479cbdb /db/migrate/20170503140202_turn_nested_groups_into_regular_groups_for_mysql.rb | |
parent | 3833f1dd84dfec844443a5b1d9ba2bd2b911c0bc (diff) | |
parent | 11716f310dcc495600f5a17e08456a1abb296482 (diff) | |
download | gitlab-ce-97c42df3b804a37e659c3cda6bd8a52570f31366.tar.gz |
Merge remote-tracking branch 'upstream/master' into 28717-additional-metrics-review-branch28717-additional-metrics-review-branch
Diffstat (limited to 'db/migrate/20170503140202_turn_nested_groups_into_regular_groups_for_mysql.rb')
-rw-r--r-- | db/migrate/20170503140202_turn_nested_groups_into_regular_groups_for_mysql.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/db/migrate/20170503140202_turn_nested_groups_into_regular_groups_for_mysql.rb b/db/migrate/20170503140202_turn_nested_groups_into_regular_groups_for_mysql.rb index c67690642c9..33908ae1156 100644 --- a/db/migrate/20170503140202_turn_nested_groups_into_regular_groups_for_mysql.rb +++ b/db/migrate/20170503140202_turn_nested_groups_into_regular_groups_for_mysql.rb @@ -87,8 +87,8 @@ class TurnNestedGroupsIntoRegularGroupsForMysql < ActiveRecord::Migration while current&.parent_id # We're using find_by(id: ...) here to deal with cases where the # parent_id may point to a missing row. - current = Namespace.unscoped.select([:id, :parent_id]). - find_by(id: current.parent_id) + current = Namespace.unscoped.select([:id, :parent_id]) + .find_by(id: current.parent_id) ancestors << current.id if current end @@ -99,11 +99,11 @@ class TurnNestedGroupsIntoRegularGroupsForMysql < ActiveRecord::Migration # Returns a relation containing all the members that have access to any of # the current namespace's parent namespaces. def all_members_for(namespace) - Member. - unscoped. - select(['user_id', 'MAX(access_level) AS access_level']). - where(source_type: 'Namespace', source_id: ancestors_for(namespace)). - group(:user_id) + Member + .unscoped + .select(['user_id', 'MAX(access_level) AS access_level']) + .where(source_type: 'Namespace', source_id: ancestors_for(namespace)) + .group(:user_id) end def bulk_insert_members(rows) |