diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-02-23 01:34:45 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-02-23 18:32:42 +0300 |
commit | 0a5b670a9392f7f8c02e83f1c2e3ed4d2d67cfde (patch) | |
tree | ee9c8d00cbaf8920eb274abe688d4e44a4591c4e /db/post_migrate/20161109150329_fix_project_records_with_invalid_visibility.rb | |
parent | 32a7041030dcb95d9476b3cbcc5d3c036aae81f3 (diff) |
Exclude migrations from Style/MutableConstant
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.rb | 14 |
1 files changed, 7 insertions, 7 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 823274b08c0..69007b8e8ed 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 @@ -14,15 +14,15 @@ class FixProjectRecordsWithInvalidVisibility < ActiveRecord::Migration 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 + .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 + # statements, in addition to the SELECT: one per visibility_level loop do to_update = connection.exec_query(finder_sql) break if to_update.rows.count == 0 |