This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveRecord::FixtureSet::File.open("#{Rails.root}/test/fixtures/settings.yml") do |fh| | |
fh.each do |fn, row| | |
p fn | |
p row | |
end | |
end | |
# see https://github.com/rails/rails/blob/v4.2.6/activerecord/lib/active_record/fixtures.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MigrateDataFromMachinesPricingsToPrices < ActiveRecord::Migration | |
def up | |
insert <<-SQL | |
DELETE FROM machines_pricings WHERE machine_id NOT IN ( select distinct machines.id from machines ) | |
SQL | |
machines_pricings = select_all("SELECT * FROM machines_pricings") | |
machines_pricings.each do |m_pricing| | |
time = "'#{Time.now.to_s(:db)}'" |