diff options
Diffstat (limited to 'db/migrate/20171003154157_rename_pokemon_met_location.rb')
-rw-r--r-- | db/migrate/20171003154157_rename_pokemon_met_location.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/db/migrate/20171003154157_rename_pokemon_met_location.rb b/db/migrate/20171003154157_rename_pokemon_met_location.rb index 3d42d53..7fc46e6 100644 --- a/db/migrate/20171003154157_rename_pokemon_met_location.rb +++ b/db/migrate/20171003154157_rename_pokemon_met_location.rb | |||
@@ -1,10 +1,10 @@ | |||
1 | class RenamePokemonMetLocation < ActiveRecord::Migration[5.1] | 1 | class RenamePokemonMetLocation < ActiveRecord::Migration[5.1] |
2 | def up | 2 | def up |
3 | change_table :pokeviewer_pokemon do |t| | 3 | change_table :pokemon do |t| |
4 | t.references :location, null: true | 4 | t.references :location, null: true |
5 | end | 5 | end |
6 | 6 | ||
7 | add_foreign_key :pokeviewer_pokemon, :pokeviewer_locations, | 7 | add_foreign_key :pokemon, :locations, |
8 | column: :location_id | 8 | column: :location_id |
9 | 9 | ||
10 | Pokeviewer::Pokemon.all.each do |p| | 10 | Pokeviewer::Pokemon.all.each do |p| |
@@ -14,11 +14,11 @@ class RenamePokemonMetLocation < ActiveRecord::Migration[5.1] | |||
14 | end | 14 | end |
15 | end | 15 | end |
16 | 16 | ||
17 | remove_column :pokeviewer_pokemon, :met_location | 17 | remove_column :pokemon, :met_location |
18 | end | 18 | end |
19 | 19 | ||
20 | def down | 20 | def down |
21 | add_column :pokeviewer_pokemon, :met_location, :string | 21 | add_column :pokemon, :met_location, :string |
22 | 22 | ||
23 | Pokeviewer::Pokemon.all.each do |p| | 23 | Pokeviewer::Pokemon.all.each do |p| |
24 | unless p.location_id.nil? | 24 | unless p.location_id.nil? |
@@ -27,6 +27,6 @@ class RenamePokemonMetLocation < ActiveRecord::Migration[5.1] | |||
27 | end | 27 | end |
28 | end | 28 | end |
29 | 29 | ||
30 | remove_column :pokeviewer_pokemon, :location_id | 30 | remove_column :pokemon, :location_id |
31 | end | 31 | end |
32 | end | 32 | end |