Skip to content

Commit d24160a

Browse files
Gargronhiyuki2578
authored andcommitted
Fix slow fallback of CopyAccountStats migration setting stats to 0 (mastodon#9930)
1 parent 1413e13 commit d24160a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

db/migrate/20181116173541_copy_account_stats.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def up_slow
4444
# uniqueness violations that we need to skip over
4545
Account.unscoped.select('id, statuses_count, following_count, followers_count, created_at, updated_at').find_each do |account|
4646
begin
47-
params = [[nil, account.id], [nil, account.statuses_count], [nil, account.following_count], [nil, account.followers_count], [nil, account.created_at], [nil, account.updated_at]]
47+
params = [[nil, account.id], [nil, account[:statuses_count]], [nil, account[:following_count]], [nil, account[:followers_count]], [nil, account.created_at], [nil, account.updated_at]]
4848
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)
4949
rescue ActiveRecord::RecordNotUnique
5050
next

0 commit comments

Comments
 (0)