]> git.openstreetmap.org Git - rails.git/blob - db/migrate/20240912181413_backfill_user_creation_address.rb
Suppress writing xml parse errors to stderr
[rails.git] / db / migrate / 20240912181413_backfill_user_creation_address.rb
1 class BackfillUserCreationAddress < ActiveRecord::Migration[7.1]
2   class User < ApplicationRecord
3   end
4
5   def up
6     User
7       .where(:creation_address => nil)
8       .where.not(:creation_ip => nil)
9       .in_batches(:of => 1000)
10       .update_all("creation_address = creation_ip::inet")
11   end
12
13   def down; end
14 end