-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing migrations. Not sure what I was thinking before :/
- Loading branch information
1 parent
0c350b1
commit ae68c53
Showing
3 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
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
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 |
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
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 |
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
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 |