Backfill block deactivates_at
This commit is contained in:
parent
30f975c609
commit
3bba84ed3a
2 changed files with 12 additions and 0 deletions
|
@ -0,0 +1,11 @@
|
||||||
|
class BackfillDeactivatesAtInUserBlocks < ActiveRecord::Migration[7.1]
|
||||||
|
class UserBlock < ApplicationRecord; end
|
||||||
|
|
||||||
|
disable_ddl_transaction!
|
||||||
|
|
||||||
|
def up
|
||||||
|
UserBlock.where(:needs_view => false, :deactivates_at => nil).in_batches do |relation|
|
||||||
|
relation.update_all("deactivates_at = GREATEST(ends_at, updated_at)")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -3579,6 +3579,7 @@ INSERT INTO "schema_migrations" (version) VALUES
|
||||||
('23'),
|
('23'),
|
||||||
('22'),
|
('22'),
|
||||||
('21'),
|
('21'),
|
||||||
|
('20240822121603'),
|
||||||
('20240813070506'),
|
('20240813070506'),
|
||||||
('20240618193051'),
|
('20240618193051'),
|
||||||
('20240605134916'),
|
('20240605134916'),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue