diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-10-15 13:49:03 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-10-15 13:49:03 -0400 |
commit | 9d6d876c62408c69c654aab1a664f1294ec668b7 (patch) | |
tree | 45442d5895cc2c1dc6aac9f7a3b6abf64ded20bf /db | |
parent | 946eda79a292cb792a61a6d7ecb2ca932de65ecd (diff) | |
download | thoughts-9d6d876c62408c69c654aab1a664f1294ec668b7.tar.gz thoughts-9d6d876c62408c69c654aab1a664f1294ec668b7.tar.bz2 thoughts-9d6d876c62408c69c654aab1a664f1294ec668b7.zip |
Added pokeviewer
Diffstat (limited to 'db')
24 files changed, 647 insertions, 1 deletions
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 @@ | |||
1 | class AddPokeviewerTokenToUser < ActiveRecord::Migration[5.1] | ||
2 | def change | ||
3 | change_table :users do |t| | ||
4 | t.string :pokeviewer_token, limit: 191 | ||
5 | end | ||
6 | |||
7 | add_index :users, :pokeviewer_token, unique: true | ||
8 | end | ||
9 | 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 @@ | |||
1 | # This migration comes from pokeviewer (originally 20170916225306) | ||
2 | class CreatePokeviewerTrainers < ActiveRecord::Migration[5.1] | ||
3 | def change | ||
4 | create_table :pokeviewer_trainers do |t| | ||
5 | t.string :game, null: false | ||
6 | t.string :name, null: false, limit: 191 | ||
7 | t.integer :number, null: false | ||
8 | |||
9 | t.timestamps | ||
10 | end | ||
11 | |||
12 | add_index :pokeviewer_trainers, [:name, :number], unique: true | ||
13 | end | ||
14 | 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 @@ | |||
1 | # This migration comes from pokeviewer (originally 20170916232015) | ||
2 | class CreatePokeviewerSpecies < ActiveRecord::Migration[5.1] | ||
3 | def change | ||
4 | create_table :pokeviewer_species do |t| | ||
5 | t.string :name, null: false, limit: 191 | ||
6 | |||
7 | t.timestamps | ||
8 | end | ||
9 | |||
10 | add_index :pokeviewer_species, :name, unique: true | ||
11 | end | ||
12 | 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 @@ | |||
1 | # This migration comes from pokeviewer (originally 20170916234251) | ||
2 | class CreatePokeviewerPokemon < ActiveRecord::Migration[5.1] | ||
3 | def change | ||
4 | create_table :pokeviewer_pokemon do |t| | ||
5 | t.string :uuid, null: false, limit: 191 | ||
6 | t.references :species, null: false | ||
7 | t.references :trainer, null: true | ||
8 | t.string :key, null: true, limit: 191 | ||
9 | t.string :ot_name, null: false | ||
10 | t.integer :ot_number, null: false | ||
11 | t.string :met_type, null: false | ||
12 | t.string :met_location, null: true | ||
13 | t.integer :met_level, null: false | ||
14 | t.boolean :shiny, null: false, default: false | ||
15 | t.string :nature, null: false | ||
16 | t.string :gender, null: false | ||
17 | t.boolean :second_ability, null: false | ||
18 | t.string :unown_letter, null: true, limit: 1 | ||
19 | |||
20 | t.timestamps | ||
21 | end | ||
22 | |||
23 | add_index :pokeviewer_pokemon, :uuid, unique: true | ||
24 | add_index :pokeviewer_pokemon, :key, unique: true | ||
25 | |||
26 | add_foreign_key :pokeviewer_pokemon, :pokeviewer_species, | ||
27 | column: :species_id | ||
28 | |||
29 | add_foreign_key :pokeviewer_pokemon, :pokeviewer_trainers, | ||
30 | column: :trainer_id | ||
31 | end | ||
32 | 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 @@ | |||
1 | # This migration comes from pokeviewer (originally 20170917011102) | ||
2 | class CreatePokeviewerMoves < ActiveRecord::Migration[5.1] | ||
3 | def change | ||
4 | create_table :pokeviewer_moves do |t| | ||
5 | t.string :name, null: false, limit: 191 | ||
6 | t.integer :pp, null: false | ||
7 | |||
8 | t.timestamps | ||
9 | end | ||
10 | |||
11 | add_index :pokeviewer_moves, :name, unique: true | ||
12 | end | ||
13 | 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 @@ | |||
1 | # This migration comes from pokeviewer (originally 20170917011258) | ||
2 | class CreatePokeviewerRevisions < ActiveRecord::Migration[5.1] | ||
3 | def change | ||
4 | create_table :pokeviewer_revisions do |t| | ||
5 | t.references :pokemon, null: false | ||
6 | t.integer :sequential_id, null: false | ||
7 | t.string :nickname, null: false | ||
8 | t.integer :experience, null: false | ||
9 | t.integer :level, null: false | ||
10 | t.integer :hp, null: false | ||
11 | t.integer :attack, null: false | ||
12 | t.integer :defense, null: false | ||
13 | t.integer :special_attack, null: false | ||
14 | t.integer :special_defense, null: false | ||
15 | t.integer :speed, null: false | ||
16 | t.integer :coolness, null: false | ||
17 | t.integer :beauty, null: false | ||
18 | t.integer :cuteness, null: false | ||
19 | t.integer :smartness, null: false | ||
20 | t.integer :toughness, null: false | ||
21 | t.integer :sheen, null: false | ||
22 | t.integer :hold_item, null: true | ||
23 | t.references :move_1, null: false | ||
24 | t.references :move_2, null: true | ||
25 | t.references :move_3, null: true | ||
26 | t.references :move_4, null: true | ||
27 | t.integer :move_1_pp_bonuses, null: false, default: 0 | ||
28 | t.integer :move_2_pp_bonuses, null: false, default: 0 | ||
29 | t.integer :move_3_pp_bonuses, null: false, default: 0 | ||
30 | t.integer :move_4_pp_bonuses, null: false, default: 0 | ||
31 | |||
32 | t.timestamps | ||
33 | end | ||
34 | |||
35 | add_index :pokeviewer_revisions, [:pokemon_id, :sequential_id], unique: true | ||
36 | |||
37 | add_foreign_key :pokeviewer_revisions, :pokewalker_pokemon, | ||
38 | column: :pokemon_id | ||
39 | |||
40 | add_foreign_key :pokeviewer_revisions, :pokewalker_moves, | ||
41 | column: :move_1_id | ||
42 | |||
43 | add_foreign_key :pokeviewer_revisions, :pokewalker_moves, | ||
44 | column: :move_2_id | ||
45 | |||
46 | add_foreign_key :pokeviewer_revisions, :pokewalker_moves, | ||
47 | column: :move_3_id | ||
48 | |||
49 | add_foreign_key :pokeviewer_revisions, :pokewalker_moves, | ||
50 | column: :move_4_id | ||
51 | end | ||
52 | 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 @@ | |||
1 | # This migration comes from pokeviewer (originally 20170924035127) | ||
2 | class MakeMetLevelNullable < ActiveRecord::Migration[5.1] | ||
3 | def change | ||
4 | change_column :pokeviewer_pokemon, :met_level, :integer, null: true | ||
5 | end | ||
6 | 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 @@ | |||
1 | # This migration comes from pokeviewer (originally 20170924152817) | ||
2 | class AddOtGenderToPokemon < ActiveRecord::Migration[5.1] | ||
3 | def change | ||
4 | add_column :pokeviewer_pokemon, :ot_gender, :string, null: false, default: "" | ||
5 | end | ||
6 | 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 @@ | |||
1 | # This migration comes from pokeviewer (originally 20170924160524) | ||
2 | class AddStorageInfoToPokemon < ActiveRecord::Migration[5.1] | ||
3 | def change | ||
4 | add_column :pokeviewer_pokemon, :box, :integer, null: true | ||
5 | add_column :pokeviewer_pokemon, :slot, :integer, null: true | ||
6 | end | ||
7 | 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 @@ | |||
1 | # This migration comes from pokeviewer (originally 20170924224550) | ||
2 | class CreatePokeviewerBoxes < ActiveRecord::Migration[5.1] | ||
3 | def change | ||
4 | create_table :pokeviewer_boxes do |t| | ||
5 | t.references :trainer, null: false | ||
6 | t.integer :number, null: false | ||
7 | t.string :name, null: false | ||
8 | |||
9 | t.timestamps | ||
10 | end | ||
11 | |||
12 | add_foreign_key :pokeviewer_boxes, :pokeviewer_trainers, column: :trainer_id | ||
13 | |||
14 | add_index :pokeviewer_boxes, [:trainer_id, :number], unique: true | ||
15 | end | ||
16 | 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 @@ | |||
1 | # This migration comes from pokeviewer (originally 20170925013807) | ||
2 | class CreatePokeviewerLocations < ActiveRecord::Migration[5.1] | ||
3 | def change | ||
4 | create_table :pokeviewer_locations do |t| | ||
5 | t.string :name, null: false | ||
6 | |||
7 | t.timestamps | ||
8 | end | ||
9 | end | ||
10 | 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 @@ | |||
1 | # This migration comes from pokeviewer (originally 20170929211529) | ||
2 | class AddRibbonsToRevision < ActiveRecord::Migration[5.1] | ||
3 | def change | ||
4 | change_table :pokeviewer_revisions do |t| | ||
5 | t.integer :cool_ribbons, null: false, default: 0 | ||
6 | t.integer :beauty_ribbons, null: false, default: 0 | ||
7 | t.integer :cute_ribbons, null: false, default: 0 | ||
8 | t.integer :smart_ribbons, null: false, default: 0 | ||
9 | t.integer :tough_ribbons, null: false, default: 0 | ||
10 | |||
11 | t.boolean :champion_ribbon, default: false | ||
12 | t.boolean :winning_ribbon, default: false | ||
13 | t.boolean :victory_ribbon, default: false | ||
14 | t.boolean :artist_ribbon, default: false | ||
15 | t.boolean :effort_ribbon, default: false | ||
16 | t.boolean :marine_ribbon, default: false | ||
17 | t.boolean :land_ribbon, default: false | ||
18 | t.boolean :sky_ribbon, default: false | ||
19 | t.boolean :country_ribbon, default: false | ||
20 | t.boolean :national_ribbon, default: false | ||
21 | t.boolean :earth_ribbon, default: false | ||
22 | t.boolean :world_ribbon, default: false | ||
23 | end | ||
24 | end | ||
25 | 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 @@ | |||
1 | # This migration comes from pokeviewer (originally 20170929221317) | ||
2 | class CreatePokeviewerGiftRibbons < ActiveRecord::Migration[5.1] | ||
3 | def change | ||
4 | create_table :pokeviewer_gift_ribbons do |t| | ||
5 | t.string :description, null: false | ||
6 | |||
7 | t.timestamps | ||
8 | end | ||
9 | end | ||
10 | 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 @@ | |||
1 | # This migration comes from pokeviewer (originally 20170930021856) | ||
2 | class AddGiftRibbonsToTrainer < ActiveRecord::Migration[5.1] | ||
3 | def change | ||
4 | change_table :pokeviewer_trainers do |t| | ||
5 | t.references :marine_ribbon, null: true | ||
6 | t.references :land_ribbon, null: true | ||
7 | t.references :sky_ribbon, null: true | ||
8 | t.references :country_ribbon, null: true | ||
9 | t.references :national_ribbon, null: true | ||
10 | t.references :earth_ribbon, null: true | ||
11 | t.references :world_ribbon, null: true | ||
12 | end | ||
13 | |||
14 | add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, | ||
15 | column: :marine_ribbon_id | ||
16 | |||
17 | add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, | ||
18 | column: :land_ribbon_id | ||
19 | |||
20 | add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, | ||
21 | column: :sky_ribbon_id | ||
22 | |||
23 | add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, | ||
24 | column: :country_ribbon_id | ||
25 | |||
26 | add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, | ||
27 | column: :national_ribbon_id | ||
28 | |||
29 | add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, | ||
30 | column: :earth_ribbon_id | ||
31 | |||
32 | add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, | ||
33 | column: :world_ribbon_id | ||
34 | end | ||
35 | 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 @@ | |||
1 | # This migration comes from pokeviewer (originally 20170930185514) | ||
2 | class CreatePokeviewerItems < ActiveRecord::Migration[5.1] | ||
3 | def change | ||
4 | create_table :pokeviewer_items do |t| | ||
5 | t.string :name, null: false | ||
6 | t.boolean :tm, null: false, default: false | ||
7 | t.references :move, null: true | ||
8 | t.string :rs_description | ||
9 | t.string :frlg_description | ||
10 | t.string :emerald_description | ||
11 | |||
12 | t.timestamps | ||
13 | end | ||
14 | |||
15 | add_foreign_key :pokeviewer_items, :pokeviewer_moves, column: :move_id | ||
16 | end | ||
17 | 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 @@ | |||
1 | # This migration comes from pokeviewer (originally 20170930190647) | ||
2 | class AddDescriptionAndTypeToMoves < ActiveRecord::Migration[5.1] | ||
3 | def change | ||
4 | change_table :pokeviewer_moves do |t| | ||
5 | t.string :move_type, null: false, default: "" | ||
6 | t.string :rs_description, null: false, default: "" | ||
7 | t.string :frlg_description, null: false, default: "" | ||
8 | t.string :emerald_description | ||
9 | end | ||
10 | |||
11 | change_column_default :pokeviewer_moves, :move_type, nil | ||
12 | change_column_default :pokeviewer_moves, :rs_description, nil | ||
13 | change_column_default :pokeviewer_moves, :frlg_description, nil | ||
14 | end | ||
15 | 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 @@ | |||
1 | # This migration comes from pokeviewer (originally 20170930213633) | ||
2 | class RenameRevisionHoldItem < ActiveRecord::Migration[5.1] | ||
3 | def change | ||
4 | change_table :pokeviewer_revisions do |t| | ||
5 | t.rename :hold_item, :item_id | ||
6 | end | ||
7 | |||
8 | add_foreign_key :pokeviewer_revisions, :pokeviewer_items, column: :item_id | ||
9 | end | ||
10 | 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 @@ | |||
1 | # This migration comes from pokeviewer (originally 20171003154157) | ||
2 | class RenamePokemonMetLocation < ActiveRecord::Migration[5.1] | ||
3 | def up | ||
4 | add_column :pokeviewer_pokemon, :location_id, :integer, null: true | ||
5 | |||
6 | add_foreign_key :pokeviewer_pokemon, :pokeviewer_locations, | ||
7 | column: :location_id | ||
8 | |||
9 | Pokeviewer::Pokemon.all.each do |p| | ||
10 | unless p.met_location.nil? | ||
11 | p.location_id = p.met_location.to_i | ||
12 | p.save! | ||
13 | end | ||
14 | end | ||
15 | |||
16 | remove_column :pokeviewer_pokemon, :met_location | ||
17 | end | ||
18 | |||
19 | def down | ||
20 | add_column :pokeviewer_pokemon, :met_location, :string | ||
21 | |||
22 | Pokeviewer::Pokemon.all.each do |p| | ||
23 | unless p.location_id.nil? | ||
24 | p.met_location = p.location_id.to_s | ||
25 | p.save! | ||
26 | end | ||
27 | end | ||
28 | |||
29 | remove_column :pokeviewer_pokemon, :location_id | ||
30 | end | ||
31 | 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 @@ | |||
1 | # This migration comes from pokeviewer (originally 20171003191205) | ||
2 | class RemoveBoxes < ActiveRecord::Migration[5.1] | ||
3 | def up | ||
4 | change_table :pokeviewer_trainers do |t| | ||
5 | t.string :box_1_name, null: false, default: "" | ||
6 | t.string :box_2_name, null: false, default: "" | ||
7 | t.string :box_3_name, null: false, default: "" | ||
8 | t.string :box_4_name, null: false, default: "" | ||
9 | t.string :box_5_name, null: false, default: "" | ||
10 | t.string :box_6_name, null: false, default: "" | ||
11 | t.string :box_7_name, null: false, default: "" | ||
12 | t.string :box_8_name, null: false, default: "" | ||
13 | t.string :box_9_name, null: false, default: "" | ||
14 | t.string :box_10_name, null: false, default: "" | ||
15 | t.string :box_11_name, null: false, default: "" | ||
16 | t.string :box_12_name, null: false, default: "" | ||
17 | t.string :box_13_name, null: false, default: "" | ||
18 | t.string :box_14_name, null: false, default: "" | ||
19 | end | ||
20 | |||
21 | change_column_default :pokeviewer_trainers, :box_1_name, nil | ||
22 | change_column_default :pokeviewer_trainers, :box_2_name, nil | ||
23 | change_column_default :pokeviewer_trainers, :box_3_name, nil | ||
24 | change_column_default :pokeviewer_trainers, :box_4_name, nil | ||
25 | change_column_default :pokeviewer_trainers, :box_5_name, nil | ||
26 | change_column_default :pokeviewer_trainers, :box_6_name, nil | ||
27 | change_column_default :pokeviewer_trainers, :box_7_name, nil | ||
28 | change_column_default :pokeviewer_trainers, :box_8_name, nil | ||
29 | change_column_default :pokeviewer_trainers, :box_9_name, nil | ||
30 | change_column_default :pokeviewer_trainers, :box_10_name, nil | ||
31 | change_column_default :pokeviewer_trainers, :box_11_name, nil | ||
32 | change_column_default :pokeviewer_trainers, :box_12_name, nil | ||
33 | change_column_default :pokeviewer_trainers, :box_13_name, nil | ||
34 | change_column_default :pokeviewer_trainers, :box_14_name, nil | ||
35 | |||
36 | Pokeviewer::Trainer.all.each do |t| | ||
37 | boxes = ActiveRecord::Base.connection.select_all( | ||
38 | "SELECT * FROM pokeviewer_boxes WHERE trainer_id = ? ORDER BY number ASC", | ||
39 | t.trainer_id).map { |b| b["name"] } | ||
40 | |||
41 | t.box_1_name = boxes.shift | ||
42 | t.box_2_name = boxes.shift | ||
43 | t.box_3_name = boxes.shift | ||
44 | t.box_4_name = boxes.shift | ||
45 | t.box_5_name = boxes.shift | ||
46 | t.box_6_name = boxes.shift | ||
47 | t.box_7_name = boxes.shift | ||
48 | t.box_8_name = boxes.shift | ||
49 | t.box_9_name = boxes.shift | ||
50 | t.box_10_name = boxes.shift | ||
51 | t.box_11_name = boxes.shift | ||
52 | t.box_12_name = boxes.shift | ||
53 | t.box_13_name = boxes.shift | ||
54 | t.box_14_name = boxes.shift | ||
55 | |||
56 | t.save | ||
57 | end | ||
58 | |||
59 | drop_table :pokeviewer_boxes | ||
60 | end | ||
61 | |||
62 | def down | ||
63 | create_table :pokeviewer_boxes do |t| | ||
64 | t.integer "trainer_id", null: false | ||
65 | t.integer "number", null: false | ||
66 | t.string "name", null: false | ||
67 | |||
68 | t.timestamps | ||
69 | end | ||
70 | |||
71 | add_index :pokeviewer_boxes, [:trainer_id, :number], unique: true | ||
72 | |||
73 | add_foreign_key :pokeviewer_boxes, :pokeviewer_trainers, column: :trainer_id | ||
74 | |||
75 | Pokeviewer::Trainer.all.each do |t| | ||
76 | Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 1, name: t.box_1_name) | ||
77 | Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 2, name: t.box_2_name) | ||
78 | Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 3, name: t.box_3_name) | ||
79 | Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 4, name: t.box_4_name) | ||
80 | Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 5, name: t.box_5_name) | ||
81 | Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 6, name: t.box_6_name) | ||
82 | Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 7, name: t.box_7_name) | ||
83 | Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 8, name: t.box_8_name) | ||
84 | Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 9, name: t.box_9_name) | ||
85 | Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 10, name: t.box_10_name) | ||
86 | Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 11, name: t.box_11_name) | ||
87 | Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 12, name: t.box_12_name) | ||
88 | Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 13, name: t.box_13_name) | ||
89 | Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 14, name: t.box_14_name) | ||
90 | end | ||
91 | |||
92 | remove_column :pokeviewer_trainers, :box_1_name | ||
93 | remove_column :pokeviewer_trainers, :box_2_name | ||
94 | remove_column :pokeviewer_trainers, :box_3_name | ||
95 | remove_column :pokeviewer_trainers, :box_4_name | ||
96 | remove_column :pokeviewer_trainers, :box_5_name | ||
97 | remove_column :pokeviewer_trainers, :box_6_name | ||
98 | remove_column :pokeviewer_trainers, :box_7_name | ||
99 | remove_column :pokeviewer_trainers, :box_8_name | ||
100 | remove_column :pokeviewer_trainers, :box_9_name | ||
101 | remove_column :pokeviewer_trainers, :box_10_name | ||
102 | remove_column :pokeviewer_trainers, :box_11_name | ||
103 | remove_column :pokeviewer_trainers, :box_12_name | ||
104 | remove_column :pokeviewer_trainers, :box_13_name | ||
105 | remove_column :pokeviewer_trainers, :box_14_name | ||
106 | end | ||
107 | 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 @@ | |||
1 | # This migration comes from pokeviewer (originally 20171004203404) | ||
2 | class AddPokeballToPokemon < ActiveRecord::Migration[5.1] | ||
3 | def change | ||
4 | change_table :pokeviewer_pokemon do |t| | ||
5 | t.string :pokeball, null: false, default: :poke | ||
6 | end | ||
7 | |||
8 | change_column_default :pokeviewer_pokemon, :pokeball, nil | ||
9 | end | ||
10 | 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 @@ | |||
1 | # This migration comes from pokeviewer (originally 20171011015325) | ||
2 | class CreatePokeviewerAbilities < ActiveRecord::Migration[5.1] | ||
3 | def change | ||
4 | create_table :pokeviewer_abilities do |t| | ||
5 | t.string :name, null: false, limit: 191 | ||
6 | t.string :description, null: false | ||
7 | |||
8 | t.timestamps | ||
9 | end | ||
10 | |||
11 | add_index :pokeviewer_abilities, :name, unique: true | ||
12 | end | ||
13 | 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 @@ | |||
1 | # This migration comes from pokeviewer (originally 20171011015648) | ||
2 | class AddTypeAndAbilityToSpecies < ActiveRecord::Migration[5.1] | ||
3 | def change | ||
4 | change_table :pokeviewer_species do |t| | ||
5 | t.string :type_1, null: false, default: "" | ||
6 | t.string :type_2 | ||
7 | t.integer :ability_1_id, null: false, default: 0 | ||
8 | t.integer :ability_2_id | ||
9 | end | ||
10 | |||
11 | change_column_default :pokeviewer_species, :type_1, nil | ||
12 | change_column_default :pokeviewer_species, :ability_1_id, nil | ||
13 | |||
14 | add_foreign_key :pokeviewer_species, :pokeviewer_abilities, | ||
15 | column: :ability_1_id | ||
16 | |||
17 | add_foreign_key :pokeviewer_species, :pokeviewer_abilities, | ||
18 | column: :ability_2_id | ||
19 | end | ||
20 | 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 @@ | |||
10 | # | 10 | # |
11 | # It's strongly recommended that you check this file into your version control system. | 11 | # It's strongly recommended that you check this file into your version control system. |
12 | 12 | ||
13 | ActiveRecord::Schema.define(version: 20170703013609) do | 13 | ActiveRecord::Schema.define(version: 20171015171559) do |
14 | 14 | ||
15 | create_table "ckeditor_assets", force: :cascade do |t| | 15 | create_table "ckeditor_assets", force: :cascade do |t| |
16 | t.string "data_file_name", null: false | 16 | t.string "data_file_name", null: false |
@@ -34,6 +34,179 @@ ActiveRecord::Schema.define(version: 20170703013609) do | |||
34 | t.datetime "updated_at", null: false | 34 | t.datetime "updated_at", null: false |
35 | end | 35 | end |
36 | 36 | ||
37 | create_table "pokeviewer_abilities", force: :cascade do |t| | ||
38 | t.string "name", limit: 191, null: false | ||
39 | t.string "description", null: false | ||
40 | t.datetime "created_at", null: false | ||
41 | t.datetime "updated_at", null: false | ||
42 | t.index ["name"], name: "index_pokeviewer_abilities_on_name", unique: true | ||
43 | end | ||
44 | |||
45 | create_table "pokeviewer_gift_ribbons", force: :cascade do |t| | ||
46 | t.string "description", null: false | ||
47 | t.datetime "created_at", null: false | ||
48 | t.datetime "updated_at", null: false | ||
49 | end | ||
50 | |||
51 | create_table "pokeviewer_items", force: :cascade do |t| | ||
52 | t.string "name", null: false | ||
53 | t.boolean "tm", default: false, null: false | ||
54 | t.integer "move_id" | ||
55 | t.string "rs_description" | ||
56 | t.string "frlg_description" | ||
57 | t.string "emerald_description" | ||
58 | t.datetime "created_at", null: false | ||
59 | t.datetime "updated_at", null: false | ||
60 | t.index ["move_id"], name: "index_pokeviewer_items_on_move_id" | ||
61 | end | ||
62 | |||
63 | create_table "pokeviewer_locations", force: :cascade do |t| | ||
64 | t.string "name", null: false | ||
65 | t.datetime "created_at", null: false | ||
66 | t.datetime "updated_at", null: false | ||
67 | end | ||
68 | |||
69 | create_table "pokeviewer_moves", force: :cascade do |t| | ||
70 | t.string "name", limit: 191, null: false | ||
71 | t.integer "pp", null: false | ||
72 | t.datetime "created_at", null: false | ||
73 | t.datetime "updated_at", null: false | ||
74 | t.string "move_type", null: false | ||
75 | t.string "rs_description", null: false | ||
76 | t.string "frlg_description", null: false | ||
77 | t.string "emerald_description" | ||
78 | t.index ["name"], name: "index_pokeviewer_moves_on_name", unique: true | ||
79 | end | ||
80 | |||
81 | create_table "pokeviewer_pokemon", force: :cascade do |t| | ||
82 | t.string "uuid", limit: 191, null: false | ||
83 | t.integer "species_id", null: false | ||
84 | t.integer "trainer_id" | ||
85 | t.string "key", limit: 191 | ||
86 | t.string "ot_name", null: false | ||
87 | t.integer "ot_number", null: false | ||
88 | t.string "met_type", null: false | ||
89 | t.integer "met_level" | ||
90 | t.boolean "shiny", default: false, null: false | ||
91 | t.string "nature", null: false | ||
92 | t.string "gender", null: false | ||
93 | t.boolean "second_ability", null: false | ||
94 | t.string "unown_letter", limit: 1 | ||
95 | t.datetime "created_at", null: false | ||
96 | t.datetime "updated_at", null: false | ||
97 | t.string "ot_gender", default: "", null: false | ||
98 | t.integer "box" | ||
99 | t.integer "slot" | ||
100 | t.integer "location_id" | ||
101 | t.string "pokeball", null: false | ||
102 | t.index ["key"], name: "index_pokeviewer_pokemon_on_key", unique: true | ||
103 | t.index ["species_id"], name: "index_pokeviewer_pokemon_on_species_id" | ||
104 | t.index ["trainer_id"], name: "index_pokeviewer_pokemon_on_trainer_id" | ||
105 | t.index ["uuid"], name: "index_pokeviewer_pokemon_on_uuid", unique: true | ||
106 | end | ||
107 | |||
108 | create_table "pokeviewer_revisions", force: :cascade do |t| | ||
109 | t.integer "pokemon_id", null: false | ||
110 | t.integer "sequential_id", null: false | ||
111 | t.string "nickname", null: false | ||
112 | t.integer "experience", null: false | ||
113 | t.integer "level", null: false | ||
114 | t.integer "hp", null: false | ||
115 | t.integer "attack", null: false | ||
116 | t.integer "defense", null: false | ||
117 | t.integer "special_attack", null: false | ||
118 | t.integer "special_defense", null: false | ||
119 | t.integer "speed", null: false | ||
120 | t.integer "coolness", null: false | ||
121 | t.integer "beauty", null: false | ||
122 | t.integer "cuteness", null: false | ||
123 | t.integer "smartness", null: false | ||
124 | t.integer "toughness", null: false | ||
125 | t.integer "sheen", null: false | ||
126 | t.integer "item_id" | ||
127 | t.integer "move_1_id", null: false | ||
128 | t.integer "move_2_id" | ||
129 | t.integer "move_3_id" | ||
130 | t.integer "move_4_id" | ||
131 | t.integer "move_1_pp_bonuses", default: 0, null: false | ||
132 | t.integer "move_2_pp_bonuses", default: 0, null: false | ||
133 | t.integer "move_3_pp_bonuses", default: 0, null: false | ||
134 | t.integer "move_4_pp_bonuses", default: 0, null: false | ||
135 | t.datetime "created_at", null: false | ||
136 | t.datetime "updated_at", null: false | ||
137 | t.integer "cool_ribbons", default: 0, null: false | ||
138 | t.integer "beauty_ribbons", default: 0, null: false | ||
139 | t.integer "cute_ribbons", default: 0, null: false | ||
140 | t.integer "smart_ribbons", default: 0, null: false | ||
141 | t.integer "tough_ribbons", default: 0, null: false | ||
142 | t.boolean "champion_ribbon", default: false | ||
143 | t.boolean "winning_ribbon", default: false | ||
144 | t.boolean "victory_ribbon", default: false | ||
145 | t.boolean "artist_ribbon", default: false | ||
146 | t.boolean "effort_ribbon", default: false | ||
147 | t.boolean "marine_ribbon", default: false | ||
148 | t.boolean "land_ribbon", default: false | ||
149 | t.boolean "sky_ribbon", default: false | ||
150 | t.boolean "country_ribbon", default: false | ||
151 | t.boolean "national_ribbon", default: false | ||
152 | t.boolean "earth_ribbon", default: false | ||
153 | t.boolean "world_ribbon", default: false | ||
154 | t.index ["move_1_id"], name: "index_pokeviewer_revisions_on_move_1_id" | ||
155 | t.index ["move_2_id"], name: "index_pokeviewer_revisions_on_move_2_id" | ||
156 | t.index ["move_3_id"], name: "index_pokeviewer_revisions_on_move_3_id" | ||
157 | t.index ["move_4_id"], name: "index_pokeviewer_revisions_on_move_4_id" | ||
158 | t.index ["pokemon_id", "sequential_id"], name: "index_pokeviewer_revisions_on_pokemon_id_and_sequential_id", unique: true | ||
159 | t.index ["pokemon_id"], name: "index_pokeviewer_revisions_on_pokemon_id" | ||
160 | end | ||
161 | |||
162 | create_table "pokeviewer_species", force: :cascade do |t| | ||
163 | t.string "name", limit: 191, null: false | ||
164 | t.datetime "created_at", null: false | ||
165 | t.datetime "updated_at", null: false | ||
166 | t.string "type_1", null: false | ||
167 | t.string "type_2" | ||
168 | t.integer "ability_1_id", null: false | ||
169 | t.integer "ability_2_id" | ||
170 | t.index ["name"], name: "index_pokeviewer_species_on_name", unique: true | ||
171 | end | ||
172 | |||
173 | create_table "pokeviewer_trainers", force: :cascade do |t| | ||
174 | t.string "game", null: false | ||
175 | t.string "name", limit: 191, null: false | ||
176 | t.integer "number", null: false | ||
177 | t.datetime "created_at", null: false | ||
178 | t.datetime "updated_at", null: false | ||
179 | t.integer "marine_ribbon_id" | ||
180 | t.integer "land_ribbon_id" | ||
181 | t.integer "sky_ribbon_id" | ||
182 | t.integer "country_ribbon_id" | ||
183 | t.integer "national_ribbon_id" | ||
184 | t.integer "earth_ribbon_id" | ||
185 | t.integer "world_ribbon_id" | ||
186 | t.string "box_1_name", null: false | ||
187 | t.string "box_2_name", null: false | ||
188 | t.string "box_3_name", null: false | ||
189 | t.string "box_4_name", null: false | ||
190 | t.string "box_5_name", null: false | ||
191 | t.string "box_6_name", null: false | ||
192 | t.string "box_7_name", null: false | ||
193 | t.string "box_8_name", null: false | ||
194 | t.string "box_9_name", null: false | ||
195 | t.string "box_10_name", null: false | ||
196 | t.string "box_11_name", null: false | ||
197 | t.string "box_12_name", null: false | ||
198 | t.string "box_13_name", null: false | ||
199 | t.string "box_14_name", null: false | ||
200 | t.index ["country_ribbon_id"], name: "index_pokeviewer_trainers_on_country_ribbon_id" | ||
201 | t.index ["earth_ribbon_id"], name: "index_pokeviewer_trainers_on_earth_ribbon_id" | ||
202 | t.index ["land_ribbon_id"], name: "index_pokeviewer_trainers_on_land_ribbon_id" | ||
203 | t.index ["marine_ribbon_id"], name: "index_pokeviewer_trainers_on_marine_ribbon_id" | ||
204 | t.index ["name", "number"], name: "index_pokeviewer_trainers_on_name_and_number", unique: true | ||
205 | t.index ["national_ribbon_id"], name: "index_pokeviewer_trainers_on_national_ribbon_id" | ||
206 | t.index ["sky_ribbon_id"], name: "index_pokeviewer_trainers_on_sky_ribbon_id" | ||
207 | t.index ["world_ribbon_id"], name: "index_pokeviewer_trainers_on_world_ribbon_id" | ||
208 | end | ||
209 | |||
37 | create_table "records", force: :cascade do |t| | 210 | create_table "records", force: :cascade do |t| |
38 | t.text "description" | 211 | t.text "description" |
39 | t.string "recordable_type", limit: 191 | 212 | t.string "recordable_type", limit: 191 |
@@ -57,8 +230,10 @@ ActiveRecord::Schema.define(version: 20170703013609) do | |||
57 | t.string "last_sign_in_ip" | 230 | t.string "last_sign_in_ip" |
58 | t.datetime "created_at", null: false | 231 | t.datetime "created_at", null: false |
59 | t.datetime "updated_at", null: false | 232 | t.datetime "updated_at", null: false |
233 | t.string "pokeviewer_token", limit: 191 | ||
60 | t.index ["email"], name: "index_users_on_email", unique: true | 234 | t.index ["email"], name: "index_users_on_email", unique: true |
61 | t.index ["login"], name: "index_users_on_login", unique: true | 235 | t.index ["login"], name: "index_users_on_login", unique: true |
236 | t.index ["pokeviewer_token"], name: "index_users_on_pokeviewer_token", unique: true | ||
62 | t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true | 237 | t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true |
63 | end | 238 | end |
64 | 239 | ||
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 @@ | |||
5 | # | 5 | # |
6 | # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) | 6 | # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) |
7 | # Character.create(name: 'Luke', movie: movies.first) | 7 | # Character.create(name: 'Luke', movie: movies.first) |
8 | Pokeviewer::Engine.load_seed \ No newline at end of file | ||