Fix crash in tootctl status remove and some old migrations (#26210)

This commit is contained in:
Claire 2023-08-02 20:54:56 +02:00 committed by GitHub
parent 6308dca76a
commit 425d77f812
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View file

@ -45,7 +45,7 @@ class CopyStatusStats < ActiveRecord::Migration[5.2]
# We cannot use bulk INSERT or overarching transactions here because of possible
# uniqueness violations that we need to skip over
Status.unscoped.select('id, reblogs_count, favourites_count, created_at, updated_at').find_each do |status|
params = [[nil, status.id], [nil, status.reblogs_count], [nil, status.favourites_count], [nil, status.created_at], [nil, status.updated_at]]
params = [status.id, status.reblogs_count, status.favourites_count, status.created_at, status.updated_at]
exec_insert('INSERT INTO status_stats (status_id, reblogs_count, favourites_count, created_at, updated_at) VALUES ($1, $2, $3, $4, $5)', nil, params)
rescue ActiveRecord::RecordNotUnique
next