]> git.openstreetmap.org Git - rails.git/blob - db/migrate/20240822121603_backfill_deactivates_at_in_user_blocks.rb
Add map filter css property
[rails.git] / db / migrate / 20240822121603_backfill_deactivates_at_in_user_blocks.rb
1 class BackfillDeactivatesAtInUserBlocks < ActiveRecord::Migration[7.1]
2   class UserBlock < ApplicationRecord; end
3
4   disable_ddl_transaction!
5
6   def up
7     UserBlock.where(:needs_view => false, :deactivates_at => nil).in_batches do |relation|
8       relation.update_all("deactivates_at = GREATEST(ends_at, updated_at)")
9     end
10   end
11 end