Skip to content

Commit

Permalink
Fix slow fallback of CopyAccountStats migration setting stats to 0 (m…
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron authored Jan 28, 2019
1 parent d71c216 commit 9184c6d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion db/migrate/20181116173541_copy_account_stats.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def up_slow
# uniqueness violations that we need to skip over
Account.unscoped.select('id, statuses_count, following_count, followers_count, created_at, updated_at').find_each do |account|
begin
params = [[nil, account.id], [nil, account.statuses_count], [nil, account.following_count], [nil, account.followers_count], [nil, account.created_at], [nil, account.updated_at]]
params = [[nil, account.id], [nil, account[:statuses_count]], [nil, account[:following_count]], [nil, account[:followers_count]], [nil, account.created_at], [nil, account.updated_at]]
exec_insert('INSERT INTO account_stats (account_id, statuses_count, following_count, followers_count, created_at, updated_at) VALUES ($1, $2, $3, $4, $5, $6)', nil, params)
rescue ActiveRecord::RecordNotUnique
next
Expand Down

0 comments on commit 9184c6d

Please sign in to comment.