Initial commit
This commit is contained in:
14
db/migrate/20180329154130_update_deprecated_currency_ids.rb
Normal file
14
db/migrate/20180329154130_update_deprecated_currency_ids.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
class UpdateDeprecatedCurrencyIds < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
# Migrate deprecated market codes to new.
|
||||
if File.file?('config/markets.old.yml')
|
||||
(YAML.load_file('config/markets.old.yml') || []).each do |market|
|
||||
execute %{UPDATE orders SET market_id = '#{market.fetch('id')}' WHERE market_id = '#{market.fetch('code')}'}
|
||||
execute %{UPDATE trades SET market_id = '#{market.fetch('id')}' WHERE market_id = '#{market.fetch('code')}'}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user