From 56f5841d4b9c12296cdfcaeff174b2627d59afc8 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 7 Dec 2024 11:49:49 -0500 Subject: Migrate to full rails app --- .../20170916225306_create_pokeviewer_trainers.rb | 4 +- .../20170916232015_create_pokeviewer_species.rb | 4 +- .../20170916234251_create_pokeviewer_pokemon.rb | 10 ++-- .../20170917011102_create_pokeviewer_moves.rb | 4 +- .../20170917011258_create_pokeviewer_revisions.rb | 14 ++--- .../20170924035127_make_met_level_nullable.rb | 2 +- .../20170924152817_add_ot_gender_to_pokemon.rb | 2 +- .../20170924160524_add_storage_info_to_pokemon.rb | 4 +- .../20170924224550_create_pokeviewer_boxes.rb | 6 +- .../20170925013807_create_pokeviewer_locations.rb | 2 +- .../20170929211529_add_ribbons_to_revision.rb | 2 +- ...0170929221317_create_pokeviewer_gift_ribbons.rb | 2 +- .../20170930021856_add_gift_ribbons_to_trainer.rb | 16 ++--- .../20170930185514_create_pokeviewer_items.rb | 4 +- ...0930190647_add_description_and_type_to_moves.rb | 8 +-- .../20170930213633_rename_revision_hold_item.rb | 6 +- .../20171003154157_rename_pokemon_met_location.rb | 10 ++-- db/migrate/20171003191205_remove_boxes.rb | 68 +++++++++++----------- .../20171004203404_add_pokeball_to_pokemon.rb | 4 +- .../20171011015325_create_pokeviewer_abilities.rb | 4 +- ...171011015648_add_type_and_ability_to_species.rb | 10 ++-- .../20180113200119_move_species_to_revision.rb | 16 ++--- ...0180114170238_cache_current_pokemon_revision.rb | 6 +- ...0129213822_create_pokeviewer_pokedex_entries.rb | 8 +-- 24 files changed, 108 insertions(+), 108 deletions(-) (limited to 'db/migrate') diff --git a/db/migrate/20170916225306_create_pokeviewer_trainers.rb b/db/migrate/20170916225306_create_pokeviewer_trainers.rb index 18e7952..f6fb9ac 100644 --- a/db/migrate/20170916225306_create_pokeviewer_trainers.rb +++ b/db/migrate/20170916225306_create_pokeviewer_trainers.rb @@ -1,6 +1,6 @@ class CreatePokeviewerTrainers < ActiveRecord::Migration[5.1] def change - create_table :pokeviewer_trainers do |t| + create_table :trainers do |t| t.string :game, null: false t.string :name, null: false, limit: 191 t.integer :number, null: false @@ -8,6 +8,6 @@ class CreatePokeviewerTrainers < ActiveRecord::Migration[5.1] t.timestamps end - add_index :pokeviewer_trainers, [:name, :number], unique: true + add_index :trainers, [:name, :number], unique: true end end diff --git a/db/migrate/20170916232015_create_pokeviewer_species.rb b/db/migrate/20170916232015_create_pokeviewer_species.rb index e6d5c09..0d630ea 100644 --- a/db/migrate/20170916232015_create_pokeviewer_species.rb +++ b/db/migrate/20170916232015_create_pokeviewer_species.rb @@ -1,11 +1,11 @@ class CreatePokeviewerSpecies < ActiveRecord::Migration[5.1] def change - create_table :pokeviewer_species do |t| + create_table :species do |t| t.string :name, null: false, limit: 191 t.timestamps end - add_index :pokeviewer_species, :name, unique: true + add_index :species, :name, unique: true end end diff --git a/db/migrate/20170916234251_create_pokeviewer_pokemon.rb b/db/migrate/20170916234251_create_pokeviewer_pokemon.rb index a8b17af..ec90875 100644 --- a/db/migrate/20170916234251_create_pokeviewer_pokemon.rb +++ b/db/migrate/20170916234251_create_pokeviewer_pokemon.rb @@ -1,6 +1,6 @@ class CreatePokeviewerPokemon < ActiveRecord::Migration[5.1] def change - create_table :pokeviewer_pokemon do |t| + create_table :pokemon do |t| t.string :uuid, null: false, limit: 191 t.references :species, null: false t.references :trainer, null: true @@ -19,13 +19,13 @@ class CreatePokeviewerPokemon < ActiveRecord::Migration[5.1] t.timestamps end - add_index :pokeviewer_pokemon, :uuid, unique: true - add_index :pokeviewer_pokemon, :key, unique: true + add_index :pokemon, :uuid, unique: true + add_index :pokemon, :key, unique: true - add_foreign_key :pokeviewer_pokemon, :pokeviewer_species, + add_foreign_key :pokemon, :species, column: :species_id - add_foreign_key :pokeviewer_pokemon, :pokeviewer_trainers, + add_foreign_key :pokemon, :trainers, column: :trainer_id end end diff --git a/db/migrate/20170917011102_create_pokeviewer_moves.rb b/db/migrate/20170917011102_create_pokeviewer_moves.rb index 86bf45f..27cebfe 100644 --- a/db/migrate/20170917011102_create_pokeviewer_moves.rb +++ b/db/migrate/20170917011102_create_pokeviewer_moves.rb @@ -1,12 +1,12 @@ class CreatePokeviewerMoves < ActiveRecord::Migration[5.1] def change - create_table :pokeviewer_moves do |t| + create_table :moves do |t| t.string :name, null: false, limit: 191 t.integer :pp, null: false t.timestamps end - add_index :pokeviewer_moves, :name, unique: true + add_index :moves, :name, unique: true end end diff --git a/db/migrate/20170917011258_create_pokeviewer_revisions.rb b/db/migrate/20170917011258_create_pokeviewer_revisions.rb index 4733303..0528ea4 100644 --- a/db/migrate/20170917011258_create_pokeviewer_revisions.rb +++ b/db/migrate/20170917011258_create_pokeviewer_revisions.rb @@ -1,6 +1,6 @@ class CreatePokeviewerRevisions < ActiveRecord::Migration[5.1] def change - create_table :pokeviewer_revisions do |t| + create_table :revisions do |t| t.references :pokemon, null: false t.integer :sequential_id, null: false t.string :nickname, null: false @@ -31,21 +31,21 @@ class CreatePokeviewerRevisions < ActiveRecord::Migration[5.1] t.timestamps end - add_index :pokeviewer_revisions, [:pokemon_id, :sequential_id], unique: true + add_index :revisions, [:pokemon_id, :sequential_id], unique: true - add_foreign_key :pokeviewer_revisions, :pokeviewer_pokemon, + add_foreign_key :revisions, :pokemon, column: :pokemon_id - add_foreign_key :pokeviewer_revisions, :pokeviewer_moves, + add_foreign_key :revisions, :moves, column: :move_1_id - add_foreign_key :pokeviewer_revisions, :pokeviewer_moves, + add_foreign_key :revisions, :moves, column: :move_2_id - add_foreign_key :pokeviewer_revisions, :pokeviewer_moves, + add_foreign_key :revisions, :moves, column: :move_3_id - add_foreign_key :pokeviewer_revisions, :pokeviewer_moves, + add_foreign_key :revisions, :moves, column: :move_4_id end end diff --git a/db/migrate/20170924035127_make_met_level_nullable.rb b/db/migrate/20170924035127_make_met_level_nullable.rb index 7cc05cb..62aa441 100644 --- a/db/migrate/20170924035127_make_met_level_nullable.rb +++ b/db/migrate/20170924035127_make_met_level_nullable.rb @@ -1,5 +1,5 @@ class MakeMetLevelNullable < ActiveRecord::Migration[5.1] def change - change_column :pokeviewer_pokemon, :met_level, :integer, null: true + change_column :pokemon, :met_level, :integer, null: true end end diff --git a/db/migrate/20170924152817_add_ot_gender_to_pokemon.rb b/db/migrate/20170924152817_add_ot_gender_to_pokemon.rb index b5f715c..c3c3086 100644 --- a/db/migrate/20170924152817_add_ot_gender_to_pokemon.rb +++ b/db/migrate/20170924152817_add_ot_gender_to_pokemon.rb @@ -1,5 +1,5 @@ class AddOtGenderToPokemon < ActiveRecord::Migration[5.1] def change - add_column :pokeviewer_pokemon, :ot_gender, :string, null: false, default: "" + add_column :pokemon, :ot_gender, :string, null: false, default: "" end end diff --git a/db/migrate/20170924160524_add_storage_info_to_pokemon.rb b/db/migrate/20170924160524_add_storage_info_to_pokemon.rb index b519b1b..a93159b 100644 --- a/db/migrate/20170924160524_add_storage_info_to_pokemon.rb +++ b/db/migrate/20170924160524_add_storage_info_to_pokemon.rb @@ -1,6 +1,6 @@ class AddStorageInfoToPokemon < ActiveRecord::Migration[5.1] def change - add_column :pokeviewer_pokemon, :box, :integer, null: true - add_column :pokeviewer_pokemon, :slot, :integer, null: true + add_column :pokemon, :box, :integer, null: true + add_column :pokemon, :slot, :integer, null: true end end diff --git a/db/migrate/20170924224550_create_pokeviewer_boxes.rb b/db/migrate/20170924224550_create_pokeviewer_boxes.rb index 4db2108..7a100c3 100644 --- a/db/migrate/20170924224550_create_pokeviewer_boxes.rb +++ b/db/migrate/20170924224550_create_pokeviewer_boxes.rb @@ -1,6 +1,6 @@ class CreatePokeviewerBoxes < ActiveRecord::Migration[5.1] def change - create_table :pokeviewer_boxes do |t| + create_table :boxes do |t| t.references :trainer, null: false t.integer :number, null: false t.string :name, null: false @@ -8,8 +8,8 @@ class CreatePokeviewerBoxes < ActiveRecord::Migration[5.1] t.timestamps end - add_foreign_key :pokeviewer_boxes, :pokeviewer_trainers, column: :trainer_id + add_foreign_key :boxes, :trainers, column: :trainer_id - add_index :pokeviewer_boxes, [:trainer_id, :number], unique: true + add_index :boxes, [:trainer_id, :number], unique: true end end diff --git a/db/migrate/20170925013807_create_pokeviewer_locations.rb b/db/migrate/20170925013807_create_pokeviewer_locations.rb index 9070077..ffd4c15 100644 --- a/db/migrate/20170925013807_create_pokeviewer_locations.rb +++ b/db/migrate/20170925013807_create_pokeviewer_locations.rb @@ -1,6 +1,6 @@ class CreatePokeviewerLocations < ActiveRecord::Migration[5.1] def change - create_table :pokeviewer_locations do |t| + create_table :locations do |t| t.string :name, null: false t.timestamps diff --git a/db/migrate/20170929211529_add_ribbons_to_revision.rb b/db/migrate/20170929211529_add_ribbons_to_revision.rb index 1dc93c1..0fb8037 100644 --- a/db/migrate/20170929211529_add_ribbons_to_revision.rb +++ b/db/migrate/20170929211529_add_ribbons_to_revision.rb @@ -1,6 +1,6 @@ class AddRibbonsToRevision < ActiveRecord::Migration[5.1] def change - change_table :pokeviewer_revisions do |t| + change_table :revisions do |t| t.integer :cool_ribbons, null: false, default: 0 t.integer :beauty_ribbons, null: false, default: 0 t.integer :cute_ribbons, null: false, default: 0 diff --git a/db/migrate/20170929221317_create_pokeviewer_gift_ribbons.rb b/db/migrate/20170929221317_create_pokeviewer_gift_ribbons.rb index deedc80..fac7635 100644 --- a/db/migrate/20170929221317_create_pokeviewer_gift_ribbons.rb +++ b/db/migrate/20170929221317_create_pokeviewer_gift_ribbons.rb @@ -1,6 +1,6 @@ class CreatePokeviewerGiftRibbons < ActiveRecord::Migration[5.1] def change - create_table :pokeviewer_gift_ribbons do |t| + create_table :gift_ribbons do |t| t.string :description, null: false t.timestamps diff --git a/db/migrate/20170930021856_add_gift_ribbons_to_trainer.rb b/db/migrate/20170930021856_add_gift_ribbons_to_trainer.rb index 2a5f9b3..ed15ea1 100644 --- a/db/migrate/20170930021856_add_gift_ribbons_to_trainer.rb +++ b/db/migrate/20170930021856_add_gift_ribbons_to_trainer.rb @@ -1,6 +1,6 @@ class AddGiftRibbonsToTrainer < ActiveRecord::Migration[5.1] def change - change_table :pokeviewer_trainers do |t| + change_table :trainers do |t| t.references :marine_ribbon, null: true t.references :land_ribbon, null: true t.references :sky_ribbon, null: true @@ -10,25 +10,25 @@ class AddGiftRibbonsToTrainer < ActiveRecord::Migration[5.1] t.references :world_ribbon, null: true end - add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, + add_foreign_key :trainers, :gift_ribbons, column: :marine_ribbon_id - add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, + add_foreign_key :trainers, :gift_ribbons, column: :land_ribbon_id - add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, + add_foreign_key :trainers, :gift_ribbons, column: :sky_ribbon_id - add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, + add_foreign_key :trainers, :gift_ribbons, column: :country_ribbon_id - add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, + add_foreign_key :trainers, :gift_ribbons, column: :national_ribbon_id - add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, + add_foreign_key :trainers, :gift_ribbons, column: :earth_ribbon_id - add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, + add_foreign_key :trainers, :gift_ribbons, column: :world_ribbon_id end end diff --git a/db/migrate/20170930185514_create_pokeviewer_items.rb b/db/migrate/20170930185514_create_pokeviewer_items.rb index 82cf3c2..4ef9c64 100644 --- a/db/migrate/20170930185514_create_pokeviewer_items.rb +++ b/db/migrate/20170930185514_create_pokeviewer_items.rb @@ -1,6 +1,6 @@ class CreatePokeviewerItems < ActiveRecord::Migration[5.1] def change - create_table :pokeviewer_items do |t| + create_table :items do |t| t.string :name, null: false t.boolean :tm, null: false, default: false t.references :move, null: true @@ -11,6 +11,6 @@ class CreatePokeviewerItems < ActiveRecord::Migration[5.1] t.timestamps end - add_foreign_key :pokeviewer_items, :pokeviewer_moves, column: :move_id + add_foreign_key :items, :moves, column: :move_id end end diff --git a/db/migrate/20170930190647_add_description_and_type_to_moves.rb b/db/migrate/20170930190647_add_description_and_type_to_moves.rb index d2fe032..e6316fd 100644 --- a/db/migrate/20170930190647_add_description_and_type_to_moves.rb +++ b/db/migrate/20170930190647_add_description_and_type_to_moves.rb @@ -1,14 +1,14 @@ class AddDescriptionAndTypeToMoves < ActiveRecord::Migration[5.1] def change - change_table :pokeviewer_moves do |t| + change_table :moves do |t| t.string :move_type, null: false, default: "" t.string :rs_description, null: false, default: "" t.string :frlg_description, null: false, default: "" t.string :emerald_description end - change_column_default :pokeviewer_moves, :move_type, nil - change_column_default :pokeviewer_moves, :rs_description, nil - change_column_default :pokeviewer_moves, :frlg_description, nil + change_column_default :moves, :move_type, nil + change_column_default :moves, :rs_description, nil + change_column_default :moves, :frlg_description, nil end end diff --git a/db/migrate/20170930213633_rename_revision_hold_item.rb b/db/migrate/20170930213633_rename_revision_hold_item.rb index fe5ce9d..4060b9b 100644 --- a/db/migrate/20170930213633_rename_revision_hold_item.rb +++ b/db/migrate/20170930213633_rename_revision_hold_item.rb @@ -1,11 +1,11 @@ class RenameRevisionHoldItem < ActiveRecord::Migration[5.1] def change - remove_column :pokeviewer_revisions, :hold_item, :integer + remove_column :revisions, :hold_item, :integer - change_table :pokeviewer_revisions do |t| + change_table :revisions do |t| t.references :item end - add_foreign_key :pokeviewer_revisions, :pokeviewer_items, column: :item_id + add_foreign_key :revisions, :items, column: :item_id end end 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 @@ class RenamePokemonMetLocation < ActiveRecord::Migration[5.1] def up - change_table :pokeviewer_pokemon do |t| + change_table :pokemon do |t| t.references :location, null: true end - add_foreign_key :pokeviewer_pokemon, :pokeviewer_locations, + add_foreign_key :pokemon, :locations, column: :location_id Pokeviewer::Pokemon.all.each do |p| @@ -14,11 +14,11 @@ class RenamePokemonMetLocation < ActiveRecord::Migration[5.1] end end - remove_column :pokeviewer_pokemon, :met_location + remove_column :pokemon, :met_location end def down - add_column :pokeviewer_pokemon, :met_location, :string + add_column :pokemon, :met_location, :string Pokeviewer::Pokemon.all.each do |p| unless p.location_id.nil? @@ -27,6 +27,6 @@ class RenamePokemonMetLocation < ActiveRecord::Migration[5.1] end end - remove_column :pokeviewer_pokemon, :location_id + remove_column :pokemon, :location_id end end diff --git a/db/migrate/20171003191205_remove_boxes.rb b/db/migrate/20171003191205_remove_boxes.rb index 476b98a..f7258fd 100644 --- a/db/migrate/20171003191205_remove_boxes.rb +++ b/db/migrate/20171003191205_remove_boxes.rb @@ -1,6 +1,6 @@ class RemoveBoxes < ActiveRecord::Migration[5.1] def up - change_table :pokeviewer_trainers do |t| + change_table :trainers do |t| t.string :box_1_name, null: false, default: "" t.string :box_2_name, null: false, default: "" t.string :box_3_name, null: false, default: "" @@ -17,24 +17,24 @@ class RemoveBoxes < ActiveRecord::Migration[5.1] t.string :box_14_name, null: false, default: "" end - change_column_default :pokeviewer_trainers, :box_1_name, nil - change_column_default :pokeviewer_trainers, :box_2_name, nil - change_column_default :pokeviewer_trainers, :box_3_name, nil - change_column_default :pokeviewer_trainers, :box_4_name, nil - change_column_default :pokeviewer_trainers, :box_5_name, nil - change_column_default :pokeviewer_trainers, :box_6_name, nil - change_column_default :pokeviewer_trainers, :box_7_name, nil - change_column_default :pokeviewer_trainers, :box_8_name, nil - change_column_default :pokeviewer_trainers, :box_9_name, nil - change_column_default :pokeviewer_trainers, :box_10_name, nil - change_column_default :pokeviewer_trainers, :box_11_name, nil - change_column_default :pokeviewer_trainers, :box_12_name, nil - change_column_default :pokeviewer_trainers, :box_13_name, nil - change_column_default :pokeviewer_trainers, :box_14_name, nil + change_column_default :trainers, :box_1_name, nil + change_column_default :trainers, :box_2_name, nil + change_column_default :trainers, :box_3_name, nil + change_column_default :trainers, :box_4_name, nil + change_column_default :trainers, :box_5_name, nil + change_column_default :trainers, :box_6_name, nil + change_column_default :trainers, :box_7_name, nil + change_column_default :trainers, :box_8_name, nil + change_column_default :trainers, :box_9_name, nil + change_column_default :trainers, :box_10_name, nil + change_column_default :trainers, :box_11_name, nil + change_column_default :trainers, :box_12_name, nil + change_column_default :trainers, :box_13_name, nil + change_column_default :trainers, :box_14_name, nil Pokeviewer::Trainer.all.each do |t| boxes = ActiveRecord::Base.connection.select_all( - "SELECT * FROM pokeviewer_boxes WHERE trainer_id = ? ORDER BY number ASC", + "SELECT * FROM boxes WHERE trainer_id = ? ORDER BY number ASC", t.trainer_id).map { |b| b["name"] } t.box_1_name = boxes.shift @@ -55,11 +55,11 @@ class RemoveBoxes < ActiveRecord::Migration[5.1] t.save end - drop_table :pokeviewer_boxes + drop_table :boxes end def down - create_table :pokeviewer_boxes do |t| + create_table :boxes do |t| t.integer "trainer_id", null: false t.integer "number", null: false t.string "name", null: false @@ -67,9 +67,9 @@ class RemoveBoxes < ActiveRecord::Migration[5.1] t.timestamps end - add_index :pokeviewer_boxes, [:trainer_id, :number], unique: true + add_index :boxes, [:trainer_id, :number], unique: true - add_foreign_key :pokeviewer_boxes, :pokeviewer_trainers, column: :trainer_id + add_foreign_key :boxes, :trainers, column: :trainer_id Pokeviewer::Trainer.all.each do |t| Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 1, name: t.box_1_name) @@ -88,19 +88,19 @@ class RemoveBoxes < ActiveRecord::Migration[5.1] Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 14, name: t.box_14_name) end - remove_column :pokeviewer_trainers, :box_1_name - remove_column :pokeviewer_trainers, :box_2_name - remove_column :pokeviewer_trainers, :box_3_name - remove_column :pokeviewer_trainers, :box_4_name - remove_column :pokeviewer_trainers, :box_5_name - remove_column :pokeviewer_trainers, :box_6_name - remove_column :pokeviewer_trainers, :box_7_name - remove_column :pokeviewer_trainers, :box_8_name - remove_column :pokeviewer_trainers, :box_9_name - remove_column :pokeviewer_trainers, :box_10_name - remove_column :pokeviewer_trainers, :box_11_name - remove_column :pokeviewer_trainers, :box_12_name - remove_column :pokeviewer_trainers, :box_13_name - remove_column :pokeviewer_trainers, :box_14_name + remove_column :trainers, :box_1_name + remove_column :trainers, :box_2_name + remove_column :trainers, :box_3_name + remove_column :trainers, :box_4_name + remove_column :trainers, :box_5_name + remove_column :trainers, :box_6_name + remove_column :trainers, :box_7_name + remove_column :trainers, :box_8_name + remove_column :trainers, :box_9_name + remove_column :trainers, :box_10_name + remove_column :trainers, :box_11_name + remove_column :trainers, :box_12_name + remove_column :trainers, :box_13_name + remove_column :trainers, :box_14_name end end diff --git a/db/migrate/20171004203404_add_pokeball_to_pokemon.rb b/db/migrate/20171004203404_add_pokeball_to_pokemon.rb index 9568d10..d66a4ca 100644 --- a/db/migrate/20171004203404_add_pokeball_to_pokemon.rb +++ b/db/migrate/20171004203404_add_pokeball_to_pokemon.rb @@ -1,9 +1,9 @@ class AddPokeballToPokemon < ActiveRecord::Migration[5.1] def change - change_table :pokeviewer_pokemon do |t| + change_table :pokemon do |t| t.string :pokeball, null: false, default: :poke end - change_column_default :pokeviewer_pokemon, :pokeball, nil + change_column_default :pokemon, :pokeball, nil end end diff --git a/db/migrate/20171011015325_create_pokeviewer_abilities.rb b/db/migrate/20171011015325_create_pokeviewer_abilities.rb index a7f6b5f..ae9645d 100644 --- a/db/migrate/20171011015325_create_pokeviewer_abilities.rb +++ b/db/migrate/20171011015325_create_pokeviewer_abilities.rb @@ -1,12 +1,12 @@ class CreatePokeviewerAbilities < ActiveRecord::Migration[5.1] def change - create_table :pokeviewer_abilities do |t| + create_table :abilities do |t| t.string :name, null: false, limit: 191 t.string :description, null: false t.timestamps end - add_index :pokeviewer_abilities, :name, unique: true + add_index :abilities, :name, unique: true end end diff --git a/db/migrate/20171011015648_add_type_and_ability_to_species.rb b/db/migrate/20171011015648_add_type_and_ability_to_species.rb index 3c24c1b..8a66d8c 100644 --- a/db/migrate/20171011015648_add_type_and_ability_to_species.rb +++ b/db/migrate/20171011015648_add_type_and_ability_to_species.rb @@ -1,19 +1,19 @@ class AddTypeAndAbilityToSpecies < ActiveRecord::Migration[5.1] def change - change_table :pokeviewer_species do |t| + change_table :species do |t| t.string :type_1, null: false, default: "" t.string :type_2 t.references :ability_1, null: false, default: 0 t.references :ability_2 end - change_column_default :pokeviewer_species, :type_1, nil - change_column_default :pokeviewer_species, :ability_1_id, nil + change_column_default :species, :type_1, nil + change_column_default :species, :ability_1_id, nil - add_foreign_key :pokeviewer_species, :pokeviewer_abilities, + add_foreign_key :species, :abilities, column: :ability_1_id - add_foreign_key :pokeviewer_species, :pokeviewer_abilities, + add_foreign_key :species, :abilities, column: :ability_2_id end end diff --git a/db/migrate/20180113200119_move_species_to_revision.rb b/db/migrate/20180113200119_move_species_to_revision.rb index 8b94d48..9f84c51 100644 --- a/db/migrate/20180113200119_move_species_to_revision.rb +++ b/db/migrate/20180113200119_move_species_to_revision.rb @@ -1,6 +1,6 @@ class MoveSpeciesToRevision < ActiveRecord::Migration[5.1] def up - change_table :pokeviewer_revisions do |t| + change_table :revisions do |t| t.references :species, null: true end @@ -9,17 +9,17 @@ class MoveSpeciesToRevision < ActiveRecord::Migration[5.1] r.save! end - remove_column :pokeviewer_pokemon, :species_id + remove_column :pokemon, :species_id - change_column_null :pokeviewer_revisions, :species_id, false + change_column_null :revisions, :species_id, false - add_foreign_key :pokeviewer_revisions, :pokeviewer_species, + add_foreign_key :revisions, :species, column: :species_id end def down def up - change_table :pokeviewer_pokemon do |t| + change_table :pokemon do |t| t.references :species, null: true end @@ -28,11 +28,11 @@ class MoveSpeciesToRevision < ActiveRecord::Migration[5.1] p.save! end - remove_column :pokeviewer_revisions, :species_id + remove_column :revisions, :species_id - change_column_null :pokeviewer_pokemon, :species_id, false + change_column_null :pokemon, :species_id, false - add_foreign_key :pokeviewer_pokemon, :pokeviewer_species, + add_foreign_key :pokemon, :species, column: :species_id end end diff --git a/db/migrate/20180114170238_cache_current_pokemon_revision.rb b/db/migrate/20180114170238_cache_current_pokemon_revision.rb index a0e1747..8b1d6ff 100644 --- a/db/migrate/20180114170238_cache_current_pokemon_revision.rb +++ b/db/migrate/20180114170238_cache_current_pokemon_revision.rb @@ -1,10 +1,10 @@ class CacheCurrentPokemonRevision < ActiveRecord::Migration[5.1] def up - change_table :pokeviewer_pokemon do |t| + change_table :pokemon do |t| t.references :current, null: true end - add_foreign_key :pokeviewer_pokemon, :pokeviewer_revisions, + add_foreign_key :pokemon, :revisions, column: :current_id Pokeviewer::Pokemon.all.each do |p| @@ -14,6 +14,6 @@ class CacheCurrentPokemonRevision < ActiveRecord::Migration[5.1] end def down - remove_column :pokeviewer_pokemon, :current_id + remove_column :pokemon, :current_id end end diff --git a/db/migrate/20180129213822_create_pokeviewer_pokedex_entries.rb b/db/migrate/20180129213822_create_pokeviewer_pokedex_entries.rb index 8456456..a6f1bec 100644 --- a/db/migrate/20180129213822_create_pokeviewer_pokedex_entries.rb +++ b/db/migrate/20180129213822_create_pokeviewer_pokedex_entries.rb @@ -1,6 +1,6 @@ class CreatePokeviewerPokedexEntries < ActiveRecord::Migration[5.1] def change - create_table :pokeviewer_pokedex_entries do |t| + create_table :pokedex_entries do |t| t.references :trainer, null: true t.references :species, null: true t.boolean :caught, null: true, default: false @@ -8,13 +8,13 @@ class CreatePokeviewerPokedexEntries < ActiveRecord::Migration[5.1] t.timestamps end - add_foreign_key :pokeviewer_pokedex_entries, :pokeviewer_trainers, + add_foreign_key :pokedex_entries, :trainers, column: :trainer_id - add_foreign_key :pokeviewer_pokedex_entries, :pokeviewer_species, + add_foreign_key :pokedex_entries, :species, column: :species_id - add_index :pokeviewer_pokedex_entries, [:trainer_id, :species_id], + add_index :pokedex_entries, [:trainer_id, :species_id], unique: true end end -- cgit 1.4.1