mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 00:12:03 +02:00
Migrate country id-s to country codes
This commit is contained in:
parent
ea6bdc19f9
commit
864c451a61
7 changed files with 41 additions and 11 deletions
22
db/migrate/20150202084444_refactor_countries.rb
Normal file
22
db/migrate/20150202084444_refactor_countries.rb
Normal file
|
@ -0,0 +1,22 @@
|
|||
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
|
Loading…
Add table
Add a link
Reference in a new issue