Initial commit
This commit is contained in:
18
db/migrate/20180425224307_change_wallet_id_to_address_id.rb
Normal file
18
db/migrate/20180425224307_change_wallet_id_to_address_id.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ChangeWalletIdToAddressId < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
return unless defined?(PaymentAddress)
|
||||
return unless column_exists?(:payment_addresses, :details)
|
||||
PaymentAddress.find_each do |pa|
|
||||
pa.details['wallet_id'].tap do |wallet_id|
|
||||
if wallet_id
|
||||
pa.details['bitgo_address_id'] = wallet_id
|
||||
pa.details.delete('wallet_id')
|
||||
pa.update_column(:details, pa.details)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user