summaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
authorMatt Jankowski <matt@jankowski.online>2023-07-12 04:03:06 -0400
committerGitHub <noreply@github.com>2023-07-12 10:03:06 +0200
commitb8b2470cf8e2aa77df2ebdcbf9106aeeb7dd6f68 (patch)
tree62a989314356cc81bae4d577f18c125175f84c59 /db
parent658742b3cd69c774277eb6b246801ce43e199d4d (diff)
Fix `Style/SlicingWithRange` cop (#25923)
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20190726175042_add_case_insensitive_index_to_tags.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/db/migrate/20190726175042_add_case_insensitive_index_to_tags.rb b/db/migrate/20190726175042_add_case_insensitive_index_to_tags.rb
index 12cc40d960d..f2d3aa8ee86 100644
--- a/db/migrate/20190726175042_add_case_insensitive_index_to_tags.rb
+++ b/db/migrate/20190726175042_add_case_insensitive_index_to_tags.rb
@@ -6,7 +6,7 @@ class AddCaseInsensitiveIndexToTags < ActiveRecord::Migration[5.2]
def up
Tag.connection.select_all('SELECT string_agg(id::text, \',\') AS ids FROM tags GROUP BY lower(name) HAVING count(*) > 1').to_ary.each do |row|
canonical_tag_id = row['ids'].split(',').first
- redundant_tag_ids = row['ids'].split(',')[1..-1]
+ redundant_tag_ids = row['ids'].split(',')[1..]
safety_assured do
execute "UPDATE accounts_tags AS t0 SET tag_id = #{canonical_tag_id} WHERE tag_id IN (#{redundant_tag_ids.join(', ')}) AND NOT EXISTS (SELECT t1.tag_id FROM accounts_tags AS t1 WHERE t1.tag_id = #{canonical_tag_id} AND t1.account_id = t0.account_id)"