From 9d6d876c62408c69c654aab1a664f1294ec668b7 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 15 Oct 2017 13:49:03 -0400 Subject: Added pokeviewer --- .../20171015171142_add_pokeviewer_token_to_user.rb | 9 ++ ...171539_create_pokeviewer_trainers.pokeviewer.rb | 14 ++ ...5171540_create_pokeviewer_species.pokeviewer.rb | 12 ++ ...5171541_create_pokeviewer_pokemon.pokeviewer.rb | 32 ++++ ...015171542_create_pokeviewer_moves.pokeviewer.rb | 13 ++ ...71543_create_pokeviewer_revisions.pokeviewer.rb | 52 ++++++ ...015171544_make_met_level_nullable.pokeviewer.rb | 6 + ...15171545_add_ot_gender_to_pokemon.pokeviewer.rb | 6 + ...71546_add_storage_info_to_pokemon.pokeviewer.rb | 7 + ...015171547_create_pokeviewer_boxes.pokeviewer.rb | 16 ++ ...71548_create_pokeviewer_locations.pokeviewer.rb | 10 ++ ...015171549_add_ribbons_to_revision.pokeviewer.rb | 25 +++ ...50_create_pokeviewer_gift_ribbons.pokeviewer.rb | 10 ++ ...71551_add_gift_ribbons_to_trainer.pokeviewer.rb | 35 ++++ ...015171552_create_pokeviewer_items.pokeviewer.rb | 17 ++ ...add_description_and_type_to_moves.pokeviewer.rb | 15 ++ ...5171554_rename_revision_hold_item.pokeviewer.rb | 10 ++ ...71555_rename_pokemon_met_location.pokeviewer.rb | 31 ++++ .../20171015171556_remove_boxes.pokeviewer.rb | 107 +++++++++++++ ...015171557_add_pokeball_to_pokemon.pokeviewer.rb | 10 ++ ...71558_create_pokeviewer_abilities.pokeviewer.rb | 13 ++ ...9_add_type_and_ability_to_species.pokeviewer.rb | 20 +++ db/schema.rb | 177 ++++++++++++++++++++- db/seeds.rb | 1 + 24 files changed, 647 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20171015171142_add_pokeviewer_token_to_user.rb create mode 100644 db/migrate/20171015171539_create_pokeviewer_trainers.pokeviewer.rb create mode 100644 db/migrate/20171015171540_create_pokeviewer_species.pokeviewer.rb create mode 100644 db/migrate/20171015171541_create_pokeviewer_pokemon.pokeviewer.rb create mode 100644 db/migrate/20171015171542_create_pokeviewer_moves.pokeviewer.rb create mode 100644 db/migrate/20171015171543_create_pokeviewer_revisions.pokeviewer.rb create mode 100644 db/migrate/20171015171544_make_met_level_nullable.pokeviewer.rb create mode 100644 db/migrate/20171015171545_add_ot_gender_to_pokemon.pokeviewer.rb create mode 100644 db/migrate/20171015171546_add_storage_info_to_pokemon.pokeviewer.rb create mode 100644 db/migrate/20171015171547_create_pokeviewer_boxes.pokeviewer.rb create mode 100644 db/migrate/20171015171548_create_pokeviewer_locations.pokeviewer.rb create mode 100644 db/migrate/20171015171549_add_ribbons_to_revision.pokeviewer.rb create mode 100644 db/migrate/20171015171550_create_pokeviewer_gift_ribbons.pokeviewer.rb create mode 100644 db/migrate/20171015171551_add_gift_ribbons_to_trainer.pokeviewer.rb create mode 100644 db/migrate/20171015171552_create_pokeviewer_items.pokeviewer.rb create mode 100644 db/migrate/20171015171553_add_description_and_type_to_moves.pokeviewer.rb create mode 100644 db/migrate/20171015171554_rename_revision_hold_item.pokeviewer.rb create mode 100644 db/migrate/20171015171555_rename_pokemon_met_location.pokeviewer.rb create mode 100644 db/migrate/20171015171556_remove_boxes.pokeviewer.rb create mode 100644 db/migrate/20171015171557_add_pokeball_to_pokemon.pokeviewer.rb create mode 100644 db/migrate/20171015171558_create_pokeviewer_abilities.pokeviewer.rb create mode 100644 db/migrate/20171015171559_add_type_and_ability_to_species.pokeviewer.rb (limited to 'db') diff --git a/db/migrate/20171015171142_add_pokeviewer_token_to_user.rb b/db/migrate/20171015171142_add_pokeviewer_token_to_user.rb new file mode 100644 index 0000000..2dc5143 --- /dev/null +++ b/db/migrate/20171015171142_add_pokeviewer_token_to_user.rb @@ -0,0 +1,9 @@ +class AddPokeviewerTokenToUser < ActiveRecord::Migration[5.1] + def change + change_table :users do |t| + t.string :pokeviewer_token, limit: 191 + end + + add_index :users, :pokeviewer_token, unique: true + end +end diff --git a/db/migrate/20171015171539_create_pokeviewer_trainers.pokeviewer.rb b/db/migrate/20171015171539_create_pokeviewer_trainers.pokeviewer.rb new file mode 100644 index 0000000..396bcea --- /dev/null +++ b/db/migrate/20171015171539_create_pokeviewer_trainers.pokeviewer.rb @@ -0,0 +1,14 @@ +# This migration comes from pokeviewer (originally 20170916225306) +class CreatePokeviewerTrainers < ActiveRecord::Migration[5.1] + def change + create_table :pokeviewer_trainers do |t| + t.string :game, null: false + t.string :name, null: false, limit: 191 + t.integer :number, null: false + + t.timestamps + end + + add_index :pokeviewer_trainers, [:name, :number], unique: true + end +end diff --git a/db/migrate/20171015171540_create_pokeviewer_species.pokeviewer.rb b/db/migrate/20171015171540_create_pokeviewer_species.pokeviewer.rb new file mode 100644 index 0000000..d3e299f --- /dev/null +++ b/db/migrate/20171015171540_create_pokeviewer_species.pokeviewer.rb @@ -0,0 +1,12 @@ +# This migration comes from pokeviewer (originally 20170916232015) +class CreatePokeviewerSpecies < ActiveRecord::Migration[5.1] + def change + create_table :pokeviewer_species do |t| + t.string :name, null: false, limit: 191 + + t.timestamps + end + + add_index :pokeviewer_species, :name, unique: true + end +end diff --git a/db/migrate/20171015171541_create_pokeviewer_pokemon.pokeviewer.rb b/db/migrate/20171015171541_create_pokeviewer_pokemon.pokeviewer.rb new file mode 100644 index 0000000..dd14d8c --- /dev/null +++ b/db/migrate/20171015171541_create_pokeviewer_pokemon.pokeviewer.rb @@ -0,0 +1,32 @@ +# This migration comes from pokeviewer (originally 20170916234251) +class CreatePokeviewerPokemon < ActiveRecord::Migration[5.1] + def change + create_table :pokeviewer_pokemon do |t| + t.string :uuid, null: false, limit: 191 + t.references :species, null: false + t.references :trainer, null: true + t.string :key, null: true, limit: 191 + t.string :ot_name, null: false + t.integer :ot_number, null: false + t.string :met_type, null: false + t.string :met_location, null: true + t.integer :met_level, null: false + t.boolean :shiny, null: false, default: false + t.string :nature, null: false + t.string :gender, null: false + t.boolean :second_ability, null: false + t.string :unown_letter, null: true, limit: 1 + + t.timestamps + end + + add_index :pokeviewer_pokemon, :uuid, unique: true + add_index :pokeviewer_pokemon, :key, unique: true + + add_foreign_key :pokeviewer_pokemon, :pokeviewer_species, + column: :species_id + + add_foreign_key :pokeviewer_pokemon, :pokeviewer_trainers, + column: :trainer_id + end +end diff --git a/db/migrate/20171015171542_create_pokeviewer_moves.pokeviewer.rb b/db/migrate/20171015171542_create_pokeviewer_moves.pokeviewer.rb new file mode 100644 index 0000000..47fa68f --- /dev/null +++ b/db/migrate/20171015171542_create_pokeviewer_moves.pokeviewer.rb @@ -0,0 +1,13 @@ +# This migration comes from pokeviewer (originally 20170917011102) +class CreatePokeviewerMoves < ActiveRecord::Migration[5.1] + def change + create_table :pokeviewer_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 + end +end diff --git a/db/migrate/20171015171543_create_pokeviewer_revisions.pokeviewer.rb b/db/migrate/20171015171543_create_pokeviewer_revisions.pokeviewer.rb new file mode 100644 index 0000000..c44c227 --- /dev/null +++ b/db/migrate/20171015171543_create_pokeviewer_revisions.pokeviewer.rb @@ -0,0 +1,52 @@ +# This migration comes from pokeviewer (originally 20170917011258) +class CreatePokeviewerRevisions < ActiveRecord::Migration[5.1] + def change + create_table :pokeviewer_revisions do |t| + t.references :pokemon, null: false + t.integer :sequential_id, null: false + t.string :nickname, null: false + t.integer :experience, null: false + t.integer :level, null: false + t.integer :hp, null: false + t.integer :attack, null: false + t.integer :defense, null: false + t.integer :special_attack, null: false + t.integer :special_defense, null: false + t.integer :speed, null: false + t.integer :coolness, null: false + t.integer :beauty, null: false + t.integer :cuteness, null: false + t.integer :smartness, null: false + t.integer :toughness, null: false + t.integer :sheen, null: false + t.integer :hold_item, null: true + t.references :move_1, null: false + t.references :move_2, null: true + t.references :move_3, null: true + t.references :move_4, null: true + t.integer :move_1_pp_bonuses, null: false, default: 0 + t.integer :move_2_pp_bonuses, null: false, default: 0 + t.integer :move_3_pp_bonuses, null: false, default: 0 + t.integer :move_4_pp_bonuses, null: false, default: 0 + + t.timestamps + end + + add_index :pokeviewer_revisions, [:pokemon_id, :sequential_id], unique: true + + add_foreign_key :pokeviewer_revisions, :pokewalker_pokemon, + column: :pokemon_id + + add_foreign_key :pokeviewer_revisions, :pokewalker_moves, + column: :move_1_id + + add_foreign_key :pokeviewer_revisions, :pokewalker_moves, + column: :move_2_id + + add_foreign_key :pokeviewer_revisions, :pokewalker_moves, + column: :move_3_id + + add_foreign_key :pokeviewer_revisions, :pokewalker_moves, + column: :move_4_id + end +end diff --git a/db/migrate/20171015171544_make_met_level_nullable.pokeviewer.rb b/db/migrate/20171015171544_make_met_level_nullable.pokeviewer.rb new file mode 100644 index 0000000..058a591 --- /dev/null +++ b/db/migrate/20171015171544_make_met_level_nullable.pokeviewer.rb @@ -0,0 +1,6 @@ +# This migration comes from pokeviewer (originally 20170924035127) +class MakeMetLevelNullable < ActiveRecord::Migration[5.1] + def change + change_column :pokeviewer_pokemon, :met_level, :integer, null: true + end +end diff --git a/db/migrate/20171015171545_add_ot_gender_to_pokemon.pokeviewer.rb b/db/migrate/20171015171545_add_ot_gender_to_pokemon.pokeviewer.rb new file mode 100644 index 0000000..8ad7f77 --- /dev/null +++ b/db/migrate/20171015171545_add_ot_gender_to_pokemon.pokeviewer.rb @@ -0,0 +1,6 @@ +# This migration comes from pokeviewer (originally 20170924152817) +class AddOtGenderToPokemon < ActiveRecord::Migration[5.1] + def change + add_column :pokeviewer_pokemon, :ot_gender, :string, null: false, default: "" + end +end diff --git a/db/migrate/20171015171546_add_storage_info_to_pokemon.pokeviewer.rb b/db/migrate/20171015171546_add_storage_info_to_pokemon.pokeviewer.rb new file mode 100644 index 0000000..794dd13 --- /dev/null +++ b/db/migrate/20171015171546_add_storage_info_to_pokemon.pokeviewer.rb @@ -0,0 +1,7 @@ +# This migration comes from pokeviewer (originally 20170924160524) +class AddStorageInfoToPokemon < ActiveRecord::Migration[5.1] + def change + add_column :pokeviewer_pokemon, :box, :integer, null: true + add_column :pokeviewer_pokemon, :slot, :integer, null: true + end +end diff --git a/db/migrate/20171015171547_create_pokeviewer_boxes.pokeviewer.rb b/db/migrate/20171015171547_create_pokeviewer_boxes.pokeviewer.rb new file mode 100644 index 0000000..90323d1 --- /dev/null +++ b/db/migrate/20171015171547_create_pokeviewer_boxes.pokeviewer.rb @@ -0,0 +1,16 @@ +# This migration comes from pokeviewer (originally 20170924224550) +class CreatePokeviewerBoxes < ActiveRecord::Migration[5.1] + def change + create_table :pokeviewer_boxes do |t| + t.references :trainer, null: false + t.integer :number, null: false + t.string :name, null: false + + t.timestamps + end + + add_foreign_key :pokeviewer_boxes, :pokeviewer_trainers, column: :trainer_id + + add_index :pokeviewer_boxes, [:trainer_id, :number], unique: true + end +end diff --git a/db/migrate/20171015171548_create_pokeviewer_locations.pokeviewer.rb b/db/migrate/20171015171548_create_pokeviewer_locations.pokeviewer.rb new file mode 100644 index 0000000..c5589b0 --- /dev/null +++ b/db/migrate/20171015171548_create_pokeviewer_locations.pokeviewer.rb @@ -0,0 +1,10 @@ +# This migration comes from pokeviewer (originally 20170925013807) +class CreatePokeviewerLocations < ActiveRecord::Migration[5.1] + def change + create_table :pokeviewer_locations do |t| + t.string :name, null: false + + t.timestamps + end + end +end diff --git a/db/migrate/20171015171549_add_ribbons_to_revision.pokeviewer.rb b/db/migrate/20171015171549_add_ribbons_to_revision.pokeviewer.rb new file mode 100644 index 0000000..01f4c2d --- /dev/null +++ b/db/migrate/20171015171549_add_ribbons_to_revision.pokeviewer.rb @@ -0,0 +1,25 @@ +# This migration comes from pokeviewer (originally 20170929211529) +class AddRibbonsToRevision < ActiveRecord::Migration[5.1] + def change + change_table :pokeviewer_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 + t.integer :smart_ribbons, null: false, default: 0 + t.integer :tough_ribbons, null: false, default: 0 + + t.boolean :champion_ribbon, default: false + t.boolean :winning_ribbon, default: false + t.boolean :victory_ribbon, default: false + t.boolean :artist_ribbon, default: false + t.boolean :effort_ribbon, default: false + t.boolean :marine_ribbon, default: false + t.boolean :land_ribbon, default: false + t.boolean :sky_ribbon, default: false + t.boolean :country_ribbon, default: false + t.boolean :national_ribbon, default: false + t.boolean :earth_ribbon, default: false + t.boolean :world_ribbon, default: false + end + end +end diff --git a/db/migrate/20171015171550_create_pokeviewer_gift_ribbons.pokeviewer.rb b/db/migrate/20171015171550_create_pokeviewer_gift_ribbons.pokeviewer.rb new file mode 100644 index 0000000..5c055f4 --- /dev/null +++ b/db/migrate/20171015171550_create_pokeviewer_gift_ribbons.pokeviewer.rb @@ -0,0 +1,10 @@ +# This migration comes from pokeviewer (originally 20170929221317) +class CreatePokeviewerGiftRibbons < ActiveRecord::Migration[5.1] + def change + create_table :pokeviewer_gift_ribbons do |t| + t.string :description, null: false + + t.timestamps + end + end +end diff --git a/db/migrate/20171015171551_add_gift_ribbons_to_trainer.pokeviewer.rb b/db/migrate/20171015171551_add_gift_ribbons_to_trainer.pokeviewer.rb new file mode 100644 index 0000000..5bef8d5 --- /dev/null +++ b/db/migrate/20171015171551_add_gift_ribbons_to_trainer.pokeviewer.rb @@ -0,0 +1,35 @@ +# This migration comes from pokeviewer (originally 20170930021856) +class AddGiftRibbonsToTrainer < ActiveRecord::Migration[5.1] + def change + change_table :pokeviewer_trainers do |t| + t.references :marine_ribbon, null: true + t.references :land_ribbon, null: true + t.references :sky_ribbon, null: true + t.references :country_ribbon, null: true + t.references :national_ribbon, null: true + t.references :earth_ribbon, null: true + t.references :world_ribbon, null: true + end + + add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, + column: :marine_ribbon_id + + add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, + column: :land_ribbon_id + + add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, + column: :sky_ribbon_id + + add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, + column: :country_ribbon_id + + add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, + column: :national_ribbon_id + + add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, + column: :earth_ribbon_id + + add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, + column: :world_ribbon_id + end +end diff --git a/db/migrate/20171015171552_create_pokeviewer_items.pokeviewer.rb b/db/migrate/20171015171552_create_pokeviewer_items.pokeviewer.rb new file mode 100644 index 0000000..7adc387 --- /dev/null +++ b/db/migrate/20171015171552_create_pokeviewer_items.pokeviewer.rb @@ -0,0 +1,17 @@ +# This migration comes from pokeviewer (originally 20170930185514) +class CreatePokeviewerItems < ActiveRecord::Migration[5.1] + def change + create_table :pokeviewer_items do |t| + t.string :name, null: false + t.boolean :tm, null: false, default: false + t.references :move, null: true + t.string :rs_description + t.string :frlg_description + t.string :emerald_description + + t.timestamps + end + + add_foreign_key :pokeviewer_items, :pokeviewer_moves, column: :move_id + end +end diff --git a/db/migrate/20171015171553_add_description_and_type_to_moves.pokeviewer.rb b/db/migrate/20171015171553_add_description_and_type_to_moves.pokeviewer.rb new file mode 100644 index 0000000..0eb7cb1 --- /dev/null +++ b/db/migrate/20171015171553_add_description_and_type_to_moves.pokeviewer.rb @@ -0,0 +1,15 @@ +# This migration comes from pokeviewer (originally 20170930190647) +class AddDescriptionAndTypeToMoves < ActiveRecord::Migration[5.1] + def change + change_table :pokeviewer_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 + end +end diff --git a/db/migrate/20171015171554_rename_revision_hold_item.pokeviewer.rb b/db/migrate/20171015171554_rename_revision_hold_item.pokeviewer.rb new file mode 100644 index 0000000..f7246de --- /dev/null +++ b/db/migrate/20171015171554_rename_revision_hold_item.pokeviewer.rb @@ -0,0 +1,10 @@ +# This migration comes from pokeviewer (originally 20170930213633) +class RenameRevisionHoldItem < ActiveRecord::Migration[5.1] + def change + change_table :pokeviewer_revisions do |t| + t.rename :hold_item, :item_id + end + + add_foreign_key :pokeviewer_revisions, :pokeviewer_items, column: :item_id + end +end diff --git a/db/migrate/20171015171555_rename_pokemon_met_location.pokeviewer.rb b/db/migrate/20171015171555_rename_pokemon_met_location.pokeviewer.rb new file mode 100644 index 0000000..afb5987 --- /dev/null +++ b/db/migrate/20171015171555_rename_pokemon_met_location.pokeviewer.rb @@ -0,0 +1,31 @@ +# This migration comes from pokeviewer (originally 20171003154157) +class RenamePokemonMetLocation < ActiveRecord::Migration[5.1] + def up + add_column :pokeviewer_pokemon, :location_id, :integer, null: true + + add_foreign_key :pokeviewer_pokemon, :pokeviewer_locations, + column: :location_id + + Pokeviewer::Pokemon.all.each do |p| + unless p.met_location.nil? + p.location_id = p.met_location.to_i + p.save! + end + end + + remove_column :pokeviewer_pokemon, :met_location + end + + def down + add_column :pokeviewer_pokemon, :met_location, :string + + Pokeviewer::Pokemon.all.each do |p| + unless p.location_id.nil? + p.met_location = p.location_id.to_s + p.save! + end + end + + remove_column :pokeviewer_pokemon, :location_id + end +end diff --git a/db/migrate/20171015171556_remove_boxes.pokeviewer.rb b/db/migrate/20171015171556_remove_boxes.pokeviewer.rb new file mode 100644 index 0000000..c3cbbb1 --- /dev/null +++ b/db/migrate/20171015171556_remove_boxes.pokeviewer.rb @@ -0,0 +1,107 @@ +# This migration comes from pokeviewer (originally 20171003191205) +class RemoveBoxes < ActiveRecord::Migration[5.1] + def up + change_table :pokeviewer_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: "" + t.string :box_4_name, null: false, default: "" + t.string :box_5_name, null: false, default: "" + t.string :box_6_name, null: false, default: "" + t.string :box_7_name, null: false, default: "" + t.string :box_8_name, null: false, default: "" + t.string :box_9_name, null: false, default: "" + t.string :box_10_name, null: false, default: "" + t.string :box_11_name, null: false, default: "" + t.string :box_12_name, null: false, default: "" + t.string :box_13_name, null: false, default: "" + 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 + + Pokeviewer::Trainer.all.each do |t| + boxes = ActiveRecord::Base.connection.select_all( + "SELECT * FROM pokeviewer_boxes WHERE trainer_id = ? ORDER BY number ASC", + t.trainer_id).map { |b| b["name"] } + + t.box_1_name = boxes.shift + t.box_2_name = boxes.shift + t.box_3_name = boxes.shift + t.box_4_name = boxes.shift + t.box_5_name = boxes.shift + t.box_6_name = boxes.shift + t.box_7_name = boxes.shift + t.box_8_name = boxes.shift + t.box_9_name = boxes.shift + t.box_10_name = boxes.shift + t.box_11_name = boxes.shift + t.box_12_name = boxes.shift + t.box_13_name = boxes.shift + t.box_14_name = boxes.shift + + t.save + end + + drop_table :pokeviewer_boxes + end + + def down + create_table :pokeviewer_boxes do |t| + t.integer "trainer_id", null: false + t.integer "number", null: false + t.string "name", null: false + + t.timestamps + end + + add_index :pokeviewer_boxes, [:trainer_id, :number], unique: true + + add_foreign_key :pokeviewer_boxes, :pokeviewer_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) + Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 2, name: t.box_2_name) + Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 3, name: t.box_3_name) + Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 4, name: t.box_4_name) + Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 5, name: t.box_5_name) + Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 6, name: t.box_6_name) + Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 7, name: t.box_7_name) + Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 8, name: t.box_8_name) + Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 9, name: t.box_9_name) + Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 10, name: t.box_10_name) + Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 11, name: t.box_11_name) + Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 12, name: t.box_12_name) + Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 13, name: t.box_13_name) + 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 + end +end diff --git a/db/migrate/20171015171557_add_pokeball_to_pokemon.pokeviewer.rb b/db/migrate/20171015171557_add_pokeball_to_pokemon.pokeviewer.rb new file mode 100644 index 0000000..01f6f97 --- /dev/null +++ b/db/migrate/20171015171557_add_pokeball_to_pokemon.pokeviewer.rb @@ -0,0 +1,10 @@ +# This migration comes from pokeviewer (originally 20171004203404) +class AddPokeballToPokemon < ActiveRecord::Migration[5.1] + def change + change_table :pokeviewer_pokemon do |t| + t.string :pokeball, null: false, default: :poke + end + + change_column_default :pokeviewer_pokemon, :pokeball, nil + end +end diff --git a/db/migrate/20171015171558_create_pokeviewer_abilities.pokeviewer.rb b/db/migrate/20171015171558_create_pokeviewer_abilities.pokeviewer.rb new file mode 100644 index 0000000..3120683 --- /dev/null +++ b/db/migrate/20171015171558_create_pokeviewer_abilities.pokeviewer.rb @@ -0,0 +1,13 @@ +# This migration comes from pokeviewer (originally 20171011015325) +class CreatePokeviewerAbilities < ActiveRecord::Migration[5.1] + def change + create_table :pokeviewer_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 + end +end diff --git a/db/migrate/20171015171559_add_type_and_ability_to_species.pokeviewer.rb b/db/migrate/20171015171559_add_type_and_ability_to_species.pokeviewer.rb new file mode 100644 index 0000000..a7da236 --- /dev/null +++ b/db/migrate/20171015171559_add_type_and_ability_to_species.pokeviewer.rb @@ -0,0 +1,20 @@ +# This migration comes from pokeviewer (originally 20171011015648) +class AddTypeAndAbilityToSpecies < ActiveRecord::Migration[5.1] + def change + change_table :pokeviewer_species do |t| + t.string :type_1, null: false, default: "" + t.string :type_2 + t.integer :ability_1_id, null: false, default: 0 + t.integer :ability_2_id + end + + change_column_default :pokeviewer_species, :type_1, nil + change_column_default :pokeviewer_species, :ability_1_id, nil + + add_foreign_key :pokeviewer_species, :pokeviewer_abilities, + column: :ability_1_id + + add_foreign_key :pokeviewer_species, :pokeviewer_abilities, + column: :ability_2_id + end +end diff --git a/db/schema.rb b/db/schema.rb index fc6614a..ede1db3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170703013609) do +ActiveRecord::Schema.define(version: 20171015171559) do create_table "ckeditor_assets", force: :cascade do |t| t.string "data_file_name", null: false @@ -34,6 +34,179 @@ ActiveRecord::Schema.define(version: 20170703013609) do t.datetime "updated_at", null: false end + create_table "pokeviewer_abilities", force: :cascade do |t| + t.string "name", limit: 191, null: false + t.string "description", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["name"], name: "index_pokeviewer_abilities_on_name", unique: true + end + + create_table "pokeviewer_gift_ribbons", force: :cascade do |t| + t.string "description", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "pokeviewer_items", force: :cascade do |t| + t.string "name", null: false + t.boolean "tm", default: false, null: false + t.integer "move_id" + t.string "rs_description" + t.string "frlg_description" + t.string "emerald_description" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["move_id"], name: "index_pokeviewer_items_on_move_id" + end + + create_table "pokeviewer_locations", force: :cascade do |t| + t.string "name", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "pokeviewer_moves", force: :cascade do |t| + t.string "name", limit: 191, null: false + t.integer "pp", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "move_type", null: false + t.string "rs_description", null: false + t.string "frlg_description", null: false + t.string "emerald_description" + t.index ["name"], name: "index_pokeviewer_moves_on_name", unique: true + end + + create_table "pokeviewer_pokemon", force: :cascade do |t| + t.string "uuid", limit: 191, null: false + t.integer "species_id", null: false + t.integer "trainer_id" + t.string "key", limit: 191 + t.string "ot_name", null: false + t.integer "ot_number", null: false + t.string "met_type", null: false + t.integer "met_level" + t.boolean "shiny", default: false, null: false + t.string "nature", null: false + t.string "gender", null: false + t.boolean "second_ability", null: false + t.string "unown_letter", limit: 1 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "ot_gender", default: "", null: false + t.integer "box" + t.integer "slot" + t.integer "location_id" + t.string "pokeball", null: false + t.index ["key"], name: "index_pokeviewer_pokemon_on_key", unique: true + t.index ["species_id"], name: "index_pokeviewer_pokemon_on_species_id" + t.index ["trainer_id"], name: "index_pokeviewer_pokemon_on_trainer_id" + t.index ["uuid"], name: "index_pokeviewer_pokemon_on_uuid", unique: true + end + + create_table "pokeviewer_revisions", force: :cascade do |t| + t.integer "pokemon_id", null: false + t.integer "sequential_id", null: false + t.string "nickname", null: false + t.integer "experience", null: false + t.integer "level", null: false + t.integer "hp", null: false + t.integer "attack", null: false + t.integer "defense", null: false + t.integer "special_attack", null: false + t.integer "special_defense", null: false + t.integer "speed", null: false + t.integer "coolness", null: false + t.integer "beauty", null: false + t.integer "cuteness", null: false + t.integer "smartness", null: false + t.integer "toughness", null: false + t.integer "sheen", null: false + t.integer "item_id" + t.integer "move_1_id", null: false + t.integer "move_2_id" + t.integer "move_3_id" + t.integer "move_4_id" + t.integer "move_1_pp_bonuses", default: 0, null: false + t.integer "move_2_pp_bonuses", default: 0, null: false + t.integer "move_3_pp_bonuses", default: 0, null: false + t.integer "move_4_pp_bonuses", default: 0, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "cool_ribbons", default: 0, null: false + t.integer "beauty_ribbons", default: 0, null: false + t.integer "cute_ribbons", default: 0, null: false + t.integer "smart_ribbons", default: 0, null: false + t.integer "tough_ribbons", default: 0, null: false + t.boolean "champion_ribbon", default: false + t.boolean "winning_ribbon", default: false + t.boolean "victory_ribbon", default: false + t.boolean "artist_ribbon", default: false + t.boolean "effort_ribbon", default: false + t.boolean "marine_ribbon", default: false + t.boolean "land_ribbon", default: false + t.boolean "sky_ribbon", default: false + t.boolean "country_ribbon", default: false + t.boolean "national_ribbon", default: false + t.boolean "earth_ribbon", default: false + t.boolean "world_ribbon", default: false + t.index ["move_1_id"], name: "index_pokeviewer_revisions_on_move_1_id" + t.index ["move_2_id"], name: "index_pokeviewer_revisions_on_move_2_id" + t.index ["move_3_id"], name: "index_pokeviewer_revisions_on_move_3_id" + t.index ["move_4_id"], name: "index_pokeviewer_revisions_on_move_4_id" + t.index ["pokemon_id", "sequential_id"], name: "index_pokeviewer_revisions_on_pokemon_id_and_sequential_id", unique: true + t.index ["pokemon_id"], name: "index_pokeviewer_revisions_on_pokemon_id" + end + + create_table "pokeviewer_species", force: :cascade do |t| + t.string "name", limit: 191, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "type_1", null: false + t.string "type_2" + t.integer "ability_1_id", null: false + t.integer "ability_2_id" + t.index ["name"], name: "index_pokeviewer_species_on_name", unique: true + end + + create_table "pokeviewer_trainers", force: :cascade do |t| + t.string "game", null: false + t.string "name", limit: 191, null: false + t.integer "number", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "marine_ribbon_id" + t.integer "land_ribbon_id" + t.integer "sky_ribbon_id" + t.integer "country_ribbon_id" + t.integer "national_ribbon_id" + t.integer "earth_ribbon_id" + t.integer "world_ribbon_id" + t.string "box_1_name", null: false + t.string "box_2_name", null: false + t.string "box_3_name", null: false + t.string "box_4_name", null: false + t.string "box_5_name", null: false + t.string "box_6_name", null: false + t.string "box_7_name", null: false + t.string "box_8_name", null: false + t.string "box_9_name", null: false + t.string "box_10_name", null: false + t.string "box_11_name", null: false + t.string "box_12_name", null: false + t.string "box_13_name", null: false + t.string "box_14_name", null: false + t.index ["country_ribbon_id"], name: "index_pokeviewer_trainers_on_country_ribbon_id" + t.index ["earth_ribbon_id"], name: "index_pokeviewer_trainers_on_earth_ribbon_id" + t.index ["land_ribbon_id"], name: "index_pokeviewer_trainers_on_land_ribbon_id" + t.index ["marine_ribbon_id"], name: "index_pokeviewer_trainers_on_marine_ribbon_id" + t.index ["name", "number"], name: "index_pokeviewer_trainers_on_name_and_number", unique: true + t.index ["national_ribbon_id"], name: "index_pokeviewer_trainers_on_national_ribbon_id" + t.index ["sky_ribbon_id"], name: "index_pokeviewer_trainers_on_sky_ribbon_id" + t.index ["world_ribbon_id"], name: "index_pokeviewer_trainers_on_world_ribbon_id" + end + create_table "records", force: :cascade do |t| t.text "description" t.string "recordable_type", limit: 191 @@ -57,8 +230,10 @@ ActiveRecord::Schema.define(version: 20170703013609) do t.string "last_sign_in_ip" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.string "pokeviewer_token", limit: 191 t.index ["email"], name: "index_users_on_email", unique: true t.index ["login"], name: "index_users_on_login", unique: true + t.index ["pokeviewer_token"], name: "index_users_on_pokeviewer_token", unique: true t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true end diff --git a/db/seeds.rb b/db/seeds.rb index 1beea2a..11823c8 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -5,3 +5,4 @@ # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Character.create(name: 'Luke', movie: movies.first) +Pokeviewer::Engine.load_seed \ No newline at end of file -- cgit 1.4.1