1 class BackfillDeactivatesAtInUserBlocks < ActiveRecord::Migration[7.1]
2 class UserBlock < ApplicationRecord; end
4 disable_ddl_transaction!
7 UserBlock.where(:needs_view => false, :deactivates_at => nil).in_batches do |relation|
8 relation.update_all("deactivates_at = GREATEST(ends_at, updated_at)")