about summary refs log tree commit diff stats
path: root/db/migrate
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2017-10-15 13:49:03 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2017-10-15 13:49:03 -0400
commit9d6d876c62408c69c654aab1a664f1294ec668b7 (patch)
tree45442d5895cc2c1dc6aac9f7a3b6abf64ded20bf /db/migrate
parent946eda79a292cb792a61a6d7ecb2ca932de65ecd (diff)
downloadthoughts-9d6d876c62408c69c654aab1a664f1294ec668b7.tar.gz
thoughts-9d6d876c62408c69c654aab1a664f1294ec668b7.tar.bz2
thoughts-9d6d876c62408c69c654aab1a664f1294ec668b7.zip
Added pokeviewer
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20171015171142_add_pokeviewer_token_to_user.rb9
-rw-r--r--db/migrate/20171015171539_create_pokeviewer_trainers.pokeviewer.rb14
-rw-r--r--db/migrate/20171015171540_create_pokeviewer_species.pokeviewer.rb12
-rw-r--r--db/migrate/20171015171541_create_pokeviewer_pokemon.pokeviewer.rb32
-rw-r--r--db/migrate/20171015171542_create_pokeviewer_moves.pokeviewer.rb13
-rw-r--r--db/migrate/20171015171543_create_pokeviewer_revisions.pokeviewer.rb52
-rw-r--r--db/migrate/20171015171544_make_met_level_nullable.pokeviewer.rb6
-rw-r--r--db/migrate/20171015171545_add_ot_gender_to_pokemon.pokeviewer.rb6
-rw-r--r--db/migrate/20171015171546_add_storage_info_to_pokemon.pokeviewer.rb7
-rw-r--r--db/migrate/20171015171547_create_pokeviewer_boxes.pokeviewer.rb16
-rw-r--r--db/migrate/20171015171548_create_pokeviewer_locations.pokeviewer.rb10
-rw-r--r--db/migrate/20171015171549_add_ribbons_to_revision.pokeviewer.rb25
-rw-r--r--db/migrate/20171015171550_create_pokeviewer_gift_ribbons.pokeviewer.rb10
-rw-r--r--db/migrate/20171015171551_add_gift_ribbons_to_trainer.pokeviewer.rb35
-rw-r--r--db/migrate/20171015171552_create_pokeviewer_items.pokeviewer.rb17
-rw-r--r--db/migrate/20171015171553_add_description_and_type_to_moves.pokeviewer.rb15
-rw-r--r--db/migrate/20171015171554_rename_revision_hold_item.pokeviewer.rb10
-rw-r--r--db/migrate/20171015171555_rename_pokemon_met_location.pokeviewer.rb31
-rw-r--r--db/migrate/20171015171556_remove_boxes.pokeviewer.rb107
-rw-r--r--db/migrate/20171015171557_add_pokeball_to_pokemon.pokeviewer.rb10
-rw-r--r--db/migrate/20171015171558_create_pokeviewer_abilities.pokeviewer.rb13
-rw-r--r--db/migrate/20171015171559_add_type_and_ability_to_species.pokeviewer.rb20
22 files changed, 470 insertions, 0 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 @@
1class 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
9end
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)
2class 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
14end
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)
2class 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
12end
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)
2class 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
32end
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)
2class 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
13end
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)
2class 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
52end
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)
2class MakeMetLevelNullable < ActiveRecord::Migration[5.1]
3 def change
4 change_column :pokeviewer_pokemon, :met_level, :integer, null: true
5 end
6end
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)
2class AddOtGenderToPokemon < ActiveRecord::Migration[5.1]
3 def change
4 add_column :pokeviewer_pokemon, :ot_gender, :string, null: false, default: ""
5 end
6end
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)
2class 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
7end
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)
2class 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
16end
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)
2class 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
10end
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)
2class 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
25end
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)
2class 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
10end
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)
2class 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
35end
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)
2class 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
17end
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)
2class 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
15end
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)
2class 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
10end
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)
2class 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
31end
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)
2class 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
107end
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)
2class 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
10end
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)
2class 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
13end
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)
2class 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
20end