mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 01:47:18 +02:00
22 lines
582 B
Ruby
22 lines
582 B
Ruby
class RefactorCountries < ActiveRecord::Migration
|
|
def change
|
|
add_column :registrars, :country_code, :string
|
|
add_column :users, :country_code, :string
|
|
add_column :addresses, :country_code, :string
|
|
|
|
Registrar.all.each do |x|
|
|
x.country_code = x.country_deprecated.try(:iso)
|
|
x.save(validate: false)
|
|
end
|
|
|
|
User.all.each do |x|
|
|
x.country_code = x.country_deprecated.try(:iso)
|
|
x.save(validate: false)
|
|
end
|
|
|
|
Address.all.each do |x|
|
|
x.country_code = x.country_deprecated.try(:iso)
|
|
x.save(validate: false)
|
|
end
|
|
end
|
|
end
|