Backfill the creation_address column from creation_ip

This commit is contained in:
Tom Hughes 2024-09-12 19:25:29 +01:00
parent e47187a8fb
commit 9ab0aee030
2 changed files with 15 additions and 0 deletions

View file

@ -0,0 +1,14 @@
class BackfillUserCreationAddress < ActiveRecord::Migration[7.1]
class User < ApplicationRecord
end
def up
User
.where(:creation_address => nil)
.where.not(:creation_ip => nil)
.in_batches(:of => 1000)
.update_all("creation_address = creation_ip::inet")
end
def down; end
end

View file

@ -3357,6 +3357,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('23'),
('22'),
('21'),
('20240912181413'),
('20240910175616'),
('20240822121603'),
('20240813070506'),