Skip to content

Commit

Permalink
fixed data migration. #213
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed May 3, 2015
1 parent 1d70213 commit b36b640
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions db/data_migrate/20150326112457_rename_pmc_europe.rb
@@ -1,17 +1,11 @@
class RenamePmcEurope < ActiveRecord::Migration
def up
europe_pmc = Source.where(name: "pmceurope").first
europe_pmc.update_attributes(name: "europe_pmc", type: "EuropePmc") if europe_pmc

europe_pmc_data = Source.where(name: "pmceuropedata").first
europe_pmc_data.update_attributes(name: "europe_pmc_data", type: "EuropePmcData") if europe_pmc_data
europe_pmc = Source.where(type: "PmcEurope").update_attributes(name: "europe_pmc", type: "EuropePmc")
europe_pmc_data = Source.where(type: "PmcEuropeData").update_attributes(name: "europe_pmc_data", type: "EuropePmcData") if europe_pmc_data
end

def down
europe_pmc = Source.where(name: "europe_pmc").first
europe_pmc.update_attributes(name: "pmceurope", type: "PmcEurope") if europe_pmc

europe_pmc_data = Source.where(name: "europe_pmc_data").first
europe_pmc_data.update_attributes(name: "pmceuropedata", type: "PmcEuropeData") if europe_pmc_data
europe_pmc = Source.where(type: "EuropePmc").update_attributes(name: "pmceurope", type: "PmcEurope") if europe_pmc
europe_pmc_data = Source.where(type: "EuropePmcData").update_attributes(name: "pmceuropedata", type: "PmcEuropeData") if europe_pmc_data
end
end

0 comments on commit b36b640

Please sign in to comment.