mirror of
https://github.com/internetee/registry.git
synced 2025-08-05 01:11:43 +02:00
Address depricated, new contact requires, domain_contacts refactor
This commit is contained in:
parent
0e252b0b6b
commit
5fd73b037a
38 changed files with 402 additions and 501 deletions
5
db/migrate/20150318084300_add_domain_contact_type.rb
Normal file
5
db/migrate/20150318084300_add_domain_contact_type.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class AddDomainContactType < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :domain_contacts, :type, :string
|
||||
end
|
||||
end
|
17
db/migrate/20150318085110_update_domain_contact_data.rb
Normal file
17
db/migrate/20150318085110_update_domain_contact_data.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
class UpdateDomainContactData < ActiveRecord::Migration
|
||||
def change
|
||||
DomainContact.all.each do |dc|
|
||||
case dc.contact_type
|
||||
when 'admin'
|
||||
dc.type = 'AdminDomainContact'
|
||||
when 'tech'
|
||||
dc.type = 'TechDomainContact'
|
||||
end
|
||||
if dc.changes.present?
|
||||
puts "Changed: #{dc.id}: #{dc.changes.inspect} #{dc.save}"
|
||||
else
|
||||
puts "No changes: #{dc.id}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
9
db/migrate/20150318114921_add_address_attributes.rb
Normal file
9
db/migrate/20150318114921_add_address_attributes.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
class AddAddressAttributes < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :contacts, :city, :string
|
||||
add_column :contacts, :street, :text
|
||||
add_column :contacts, :zip, :string
|
||||
add_column :contacts, :country_code, :string
|
||||
add_column :contacts, :state, :string
|
||||
end
|
||||
end
|
16
db/migrate/20150319125655_update_contact_data.rb
Normal file
16
db/migrate/20150319125655_update_contact_data.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
class UpdateContactData < ActiveRecord::Migration
|
||||
def change
|
||||
Address.all.each do |a|
|
||||
c = a.contact
|
||||
c.city = a.city
|
||||
c.street = ""
|
||||
c.street << a.street if a.street.present?
|
||||
c.street << "\n#{a.street2}" if a.street2.present?
|
||||
c.street << "\n#{a.street3}" if a.street3.present?
|
||||
c.zip = a.zip
|
||||
c.country_code = a.country_code
|
||||
c.state = a.state
|
||||
puts "#{c.id} changes: #{c.changes.inspect}; #{c.save(false)}"
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
class DepricateContactDisclouserTable < ActiveRecord::Migration
|
||||
def change
|
||||
drop_table :contact_disclosures
|
||||
drop_table :log_contact_disclosures
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue