From: Tom Hughes Date: Thu, 12 Sep 2024 18:25:29 +0000 (+0100) Subject: Backfill the creation_address column from creation_ip X-Git-Tag: live~128^2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/9ab0aee030fbee67f6481dc79040fd9e99282c4f?hp=-c Backfill the creation_address column from creation_ip --- 9ab0aee030fbee67f6481dc79040fd9e99282c4f diff --git a/db/migrate/20240912181413_backfill_user_creation_address.rb b/db/migrate/20240912181413_backfill_user_creation_address.rb new file mode 100644 index 000000000..3cc14f238 --- /dev/null +++ b/db/migrate/20240912181413_backfill_user_creation_address.rb @@ -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 diff --git a/db/structure.sql b/db/structure.sql index 9318185c6..60164558c 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -3357,6 +3357,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('23'), ('22'), ('21'), +('20240912181413'), ('20240910175616'), ('20240822121603'), ('20240813070506'),