Skip to content

Commit

Permalink
Fixing migrations. Not sure what I was thinking before :/
Browse files Browse the repository at this point in the history
  • Loading branch information
mattbeedle committed Apr 17, 2016
1 parent 0c350b1 commit ae68c53
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
16 changes: 16 additions & 0 deletions db/migrate/11_fix_usda_weights.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class FixUsdaWeights < ActiveRecord::Migration
def change
remove_column :usda_weights, :id

change_table :usda_weights do |t|
t.remove_index :nutrient_databank_number

t.index [
:nutrient_databank_number,
:sequence_number
], {
unique: true
}
end
end
end
20 changes: 20 additions & 0 deletions db/migrate/12_fix_usda_foods_nutrients.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
class FixUsdaFoodsNutrients < ActiveRecord::Migration
def change
remove_column :usda_foods_nutrients, :id

change_table :usda_foods_nutrients do |t|
t.remove_index [
:nutrient_databank_number,
:nutrient_number
]

t.index [
:nutrient_databank_number,
:nutrient_number
], {
unique: true,
name: 'index_usda_foods_nutrients_on_unique_keys'
}
end
end
end
10 changes: 10 additions & 0 deletions db/migrate/13_fix_usda_source_codes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class FixUsdaSourceCodes < ActiveRecord::Migration
def change
remove_column :source_codes, :id

change_table :source_codes do |t|
t.remove_index :code
t.index :code, unique: true
end
end
end

0 comments on commit ae68c53

Please sign in to comment.