summaryrefslogtreecommitdiff
path: root/db/post_migrate/20161109150329_fix_project_records_with_invalid_visibility.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-02-22 16:50:15 -0600
committerDouwe Maan <douwe@selenight.nl>2017-02-23 09:33:05 -0600
commit1fe7501b49f896b74102c4b970310aa9ae34da85 (patch)
treece271afb0fbaaa14291c1dc9009cd7815ee25463 /db/post_migrate/20161109150329_fix_project_records_with_invalid_visibility.rb
parentbdbc7d967a0c3d95d5e4ea19a2a5be41268d3540 (diff)
downloadgitlab-ce-1fe7501b49f896b74102c4b970310aa9ae34da85.tar.gz
Revert "Prefer leading style for Style/DotPosition"
This reverts commit cb10b725c8929b8b4460f89c9d96c773af39ba6b.
Diffstat (limited to 'db/post_migrate/20161109150329_fix_project_records_with_invalid_visibility.rb')
-rw-r--r--db/post_migrate/20161109150329_fix_project_records_with_invalid_visibility.rb22
1 files changed, 11 insertions, 11 deletions
diff --git a/db/post_migrate/20161109150329_fix_project_records_with_invalid_visibility.rb b/db/post_migrate/20161109150329_fix_project_records_with_invalid_visibility.rb
index 69007b8e8ed..14b5ef476f0 100644
--- a/db/post_migrate/20161109150329_fix_project_records_with_invalid_visibility.rb
+++ b/db/post_migrate/20161109150329_fix_project_records_with_invalid_visibility.rb
@@ -13,13 +13,13 @@ class FixProjectRecordsWithInvalidVisibility < ActiveRecord::Migration
namespaces = Arel::Table.new(:namespaces)
finder_sql =
- projects
- .join(namespaces, Arel::Nodes::InnerJoin)
- .on(projects[:namespace_id].eq(namespaces[:id]))
- .where(projects[:visibility_level].gt(namespaces[:visibility_level]))
- .project(projects[:id], namespaces[:visibility_level])
- .take(BATCH_SIZE)
- .to_sql
+ projects.
+ join(namespaces, Arel::Nodes::InnerJoin).
+ on(projects[:namespace_id].eq(namespaces[:id])).
+ where(projects[:visibility_level].gt(namespaces[:visibility_level])).
+ project(projects[:id], namespaces[:visibility_level]).
+ take(BATCH_SIZE).
+ to_sql
# Update matching rows in batches. Each batch can cause up to 3 UPDATE
# statements, in addition to the SELECT: one per visibility_level
@@ -33,10 +33,10 @@ class FixProjectRecordsWithInvalidVisibility < ActiveRecord::Migration
end
updates.each do |visibility_level, project_ids|
- updater = Arel::UpdateManager.new(ActiveRecord::Base)
- .table(projects)
- .set(projects[:visibility_level] => visibility_level)
- .where(projects[:id].in(project_ids))
+ updater = Arel::UpdateManager.new(ActiveRecord::Base).
+ table(projects).
+ set(projects[:visibility_level] => visibility_level).
+ where(projects[:id].in(project_ids))
ActiveRecord::Base.connection.exec_update(updater.to_sql, self.class.name, [])
end