diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-12-07 11:49:49 -0500 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-12-07 11:49:49 -0500 |
commit | 56f5841d4b9c12296cdfcaeff174b2627d59afc8 (patch) | |
tree | 4f7da4ebbe5ee15a1594b26466ed78e2cf10de35 /db/migrate | |
parent | c1b0443ba2aebdbd39291ddab0c189f3f4831320 (diff) | |
download | pokeviewer-56f5841d4b9c12296cdfcaeff174b2627d59afc8.tar.gz pokeviewer-56f5841d4b9c12296cdfcaeff174b2627d59afc8.tar.bz2 pokeviewer-56f5841d4b9c12296cdfcaeff174b2627d59afc8.zip |
Migrate to full rails app
Diffstat (limited to 'db/migrate')
24 files changed, 108 insertions, 108 deletions
diff --git a/db/migrate/20170916225306_create_pokeviewer_trainers.rb b/db/migrate/20170916225306_create_pokeviewer_trainers.rb index 18e7952..f6fb9ac 100644 --- a/db/migrate/20170916225306_create_pokeviewer_trainers.rb +++ b/db/migrate/20170916225306_create_pokeviewer_trainers.rb | |||
@@ -1,6 +1,6 @@ | |||
1 | class CreatePokeviewerTrainers < ActiveRecord::Migration[5.1] | 1 | class CreatePokeviewerTrainers < ActiveRecord::Migration[5.1] |
2 | def change | 2 | def change |
3 | create_table :pokeviewer_trainers do |t| | 3 | create_table :trainers do |t| |
4 | t.string :game, null: false | 4 | t.string :game, null: false |
5 | t.string :name, null: false, limit: 191 | 5 | t.string :name, null: false, limit: 191 |
6 | t.integer :number, null: false | 6 | t.integer :number, null: false |
@@ -8,6 +8,6 @@ class CreatePokeviewerTrainers < ActiveRecord::Migration[5.1] | |||
8 | t.timestamps | 8 | t.timestamps |
9 | end | 9 | end |
10 | 10 | ||
11 | add_index :pokeviewer_trainers, [:name, :number], unique: true | 11 | add_index :trainers, [:name, :number], unique: true |
12 | end | 12 | end |
13 | end | 13 | end |
diff --git a/db/migrate/20170916232015_create_pokeviewer_species.rb b/db/migrate/20170916232015_create_pokeviewer_species.rb index e6d5c09..0d630ea 100644 --- a/db/migrate/20170916232015_create_pokeviewer_species.rb +++ b/db/migrate/20170916232015_create_pokeviewer_species.rb | |||
@@ -1,11 +1,11 @@ | |||
1 | class CreatePokeviewerSpecies < ActiveRecord::Migration[5.1] | 1 | class CreatePokeviewerSpecies < ActiveRecord::Migration[5.1] |
2 | def change | 2 | def change |
3 | create_table :pokeviewer_species do |t| | 3 | create_table :species do |t| |
4 | t.string :name, null: false, limit: 191 | 4 | t.string :name, null: false, limit: 191 |
5 | 5 | ||
6 | t.timestamps | 6 | t.timestamps |
7 | end | 7 | end |
8 | 8 | ||
9 | add_index :pokeviewer_species, :name, unique: true | 9 | add_index :species, :name, unique: true |
10 | end | 10 | end |
11 | end | 11 | end |
diff --git a/db/migrate/20170916234251_create_pokeviewer_pokemon.rb b/db/migrate/20170916234251_create_pokeviewer_pokemon.rb index a8b17af..ec90875 100644 --- a/db/migrate/20170916234251_create_pokeviewer_pokemon.rb +++ b/db/migrate/20170916234251_create_pokeviewer_pokemon.rb | |||
@@ -1,6 +1,6 @@ | |||
1 | class CreatePokeviewerPokemon < ActiveRecord::Migration[5.1] | 1 | class CreatePokeviewerPokemon < ActiveRecord::Migration[5.1] |
2 | def change | 2 | def change |
3 | create_table :pokeviewer_pokemon do |t| | 3 | create_table :pokemon do |t| |
4 | t.string :uuid, null: false, limit: 191 | 4 | t.string :uuid, null: false, limit: 191 |
5 | t.references :species, null: false | 5 | t.references :species, null: false |
6 | t.references :trainer, null: true | 6 | t.references :trainer, null: true |
@@ -19,13 +19,13 @@ class CreatePokeviewerPokemon < ActiveRecord::Migration[5.1] | |||
19 | t.timestamps | 19 | t.timestamps |
20 | end | 20 | end |
21 | 21 | ||
22 | add_index :pokeviewer_pokemon, :uuid, unique: true | 22 | add_index :pokemon, :uuid, unique: true |
23 | add_index :pokeviewer_pokemon, :key, unique: true | 23 | add_index :pokemon, :key, unique: true |
24 | 24 | ||
25 | add_foreign_key :pokeviewer_pokemon, :pokeviewer_species, | 25 | add_foreign_key :pokemon, :species, |
26 | column: :species_id | 26 | column: :species_id |
27 | 27 | ||
28 | add_foreign_key :pokeviewer_pokemon, :pokeviewer_trainers, | 28 | add_foreign_key :pokemon, :trainers, |
29 | column: :trainer_id | 29 | column: :trainer_id |
30 | end | 30 | end |
31 | end | 31 | end |
diff --git a/db/migrate/20170917011102_create_pokeviewer_moves.rb b/db/migrate/20170917011102_create_pokeviewer_moves.rb index 86bf45f..27cebfe 100644 --- a/db/migrate/20170917011102_create_pokeviewer_moves.rb +++ b/db/migrate/20170917011102_create_pokeviewer_moves.rb | |||
@@ -1,12 +1,12 @@ | |||
1 | class CreatePokeviewerMoves < ActiveRecord::Migration[5.1] | 1 | class CreatePokeviewerMoves < ActiveRecord::Migration[5.1] |
2 | def change | 2 | def change |
3 | create_table :pokeviewer_moves do |t| | 3 | create_table :moves do |t| |
4 | t.string :name, null: false, limit: 191 | 4 | t.string :name, null: false, limit: 191 |
5 | t.integer :pp, null: false | 5 | t.integer :pp, null: false |
6 | 6 | ||
7 | t.timestamps | 7 | t.timestamps |
8 | end | 8 | end |
9 | 9 | ||
10 | add_index :pokeviewer_moves, :name, unique: true | 10 | add_index :moves, :name, unique: true |
11 | end | 11 | end |
12 | end | 12 | end |
diff --git a/db/migrate/20170917011258_create_pokeviewer_revisions.rb b/db/migrate/20170917011258_create_pokeviewer_revisions.rb index 4733303..0528ea4 100644 --- a/db/migrate/20170917011258_create_pokeviewer_revisions.rb +++ b/db/migrate/20170917011258_create_pokeviewer_revisions.rb | |||
@@ -1,6 +1,6 @@ | |||
1 | class CreatePokeviewerRevisions < ActiveRecord::Migration[5.1] | 1 | class CreatePokeviewerRevisions < ActiveRecord::Migration[5.1] |
2 | def change | 2 | def change |
3 | create_table :pokeviewer_revisions do |t| | 3 | create_table :revisions do |t| |
4 | t.references :pokemon, null: false | 4 | t.references :pokemon, null: false |
5 | t.integer :sequential_id, null: false | 5 | t.integer :sequential_id, null: false |
6 | t.string :nickname, null: false | 6 | t.string :nickname, null: false |
@@ -31,21 +31,21 @@ class CreatePokeviewerRevisions < ActiveRecord::Migration[5.1] | |||
31 | t.timestamps | 31 | t.timestamps |
32 | end | 32 | end |
33 | 33 | ||
34 | add_index :pokeviewer_revisions, [:pokemon_id, :sequential_id], unique: true | 34 | add_index :revisions, [:pokemon_id, :sequential_id], unique: true |
35 | 35 | ||
36 | add_foreign_key :pokeviewer_revisions, :pokeviewer_pokemon, | 36 | add_foreign_key :revisions, :pokemon, |
37 | column: :pokemon_id | 37 | column: :pokemon_id |
38 | 38 | ||
39 | add_foreign_key :pokeviewer_revisions, :pokeviewer_moves, | 39 | add_foreign_key :revisions, :moves, |
40 | column: :move_1_id | 40 | column: :move_1_id |
41 | 41 | ||
42 | add_foreign_key :pokeviewer_revisions, :pokeviewer_moves, | 42 | add_foreign_key :revisions, :moves, |
43 | column: :move_2_id | 43 | column: :move_2_id |
44 | 44 | ||
45 | add_foreign_key :pokeviewer_revisions, :pokeviewer_moves, | 45 | add_foreign_key :revisions, :moves, |
46 | column: :move_3_id | 46 | column: :move_3_id |
47 | 47 | ||
48 | add_foreign_key :pokeviewer_revisions, :pokeviewer_moves, | 48 | add_foreign_key :revisions, :moves, |
49 | column: :move_4_id | 49 | column: :move_4_id |
50 | end | 50 | end |
51 | end | 51 | end |
diff --git a/db/migrate/20170924035127_make_met_level_nullable.rb b/db/migrate/20170924035127_make_met_level_nullable.rb index 7cc05cb..62aa441 100644 --- a/db/migrate/20170924035127_make_met_level_nullable.rb +++ b/db/migrate/20170924035127_make_met_level_nullable.rb | |||
@@ -1,5 +1,5 @@ | |||
1 | class MakeMetLevelNullable < ActiveRecord::Migration[5.1] | 1 | class MakeMetLevelNullable < ActiveRecord::Migration[5.1] |
2 | def change | 2 | def change |
3 | change_column :pokeviewer_pokemon, :met_level, :integer, null: true | 3 | change_column :pokemon, :met_level, :integer, null: true |
4 | end | 4 | end |
5 | end | 5 | end |
diff --git a/db/migrate/20170924152817_add_ot_gender_to_pokemon.rb b/db/migrate/20170924152817_add_ot_gender_to_pokemon.rb index b5f715c..c3c3086 100644 --- a/db/migrate/20170924152817_add_ot_gender_to_pokemon.rb +++ b/db/migrate/20170924152817_add_ot_gender_to_pokemon.rb | |||
@@ -1,5 +1,5 @@ | |||
1 | class AddOtGenderToPokemon < ActiveRecord::Migration[5.1] | 1 | class AddOtGenderToPokemon < ActiveRecord::Migration[5.1] |
2 | def change | 2 | def change |
3 | add_column :pokeviewer_pokemon, :ot_gender, :string, null: false, default: "" | 3 | add_column :pokemon, :ot_gender, :string, null: false, default: "" |
4 | end | 4 | end |
5 | end | 5 | end |
diff --git a/db/migrate/20170924160524_add_storage_info_to_pokemon.rb b/db/migrate/20170924160524_add_storage_info_to_pokemon.rb index b519b1b..a93159b 100644 --- a/db/migrate/20170924160524_add_storage_info_to_pokemon.rb +++ b/db/migrate/20170924160524_add_storage_info_to_pokemon.rb | |||
@@ -1,6 +1,6 @@ | |||
1 | class AddStorageInfoToPokemon < ActiveRecord::Migration[5.1] | 1 | class AddStorageInfoToPokemon < ActiveRecord::Migration[5.1] |
2 | def change | 2 | def change |
3 | add_column :pokeviewer_pokemon, :box, :integer, null: true | 3 | add_column :pokemon, :box, :integer, null: true |
4 | add_column :pokeviewer_pokemon, :slot, :integer, null: true | 4 | add_column :pokemon, :slot, :integer, null: true |
5 | end | 5 | end |
6 | end | 6 | end |
diff --git a/db/migrate/20170924224550_create_pokeviewer_boxes.rb b/db/migrate/20170924224550_create_pokeviewer_boxes.rb index 4db2108..7a100c3 100644 --- a/db/migrate/20170924224550_create_pokeviewer_boxes.rb +++ b/db/migrate/20170924224550_create_pokeviewer_boxes.rb | |||
@@ -1,6 +1,6 @@ | |||
1 | class CreatePokeviewerBoxes < ActiveRecord::Migration[5.1] | 1 | class CreatePokeviewerBoxes < ActiveRecord::Migration[5.1] |
2 | def change | 2 | def change |
3 | create_table :pokeviewer_boxes do |t| | 3 | create_table :boxes do |t| |
4 | t.references :trainer, null: false | 4 | t.references :trainer, null: false |
5 | t.integer :number, null: false | 5 | t.integer :number, null: false |
6 | t.string :name, null: false | 6 | t.string :name, null: false |
@@ -8,8 +8,8 @@ class CreatePokeviewerBoxes < ActiveRecord::Migration[5.1] | |||
8 | t.timestamps | 8 | t.timestamps |
9 | end | 9 | end |
10 | 10 | ||
11 | add_foreign_key :pokeviewer_boxes, :pokeviewer_trainers, column: :trainer_id | 11 | add_foreign_key :boxes, :trainers, column: :trainer_id |
12 | 12 | ||
13 | add_index :pokeviewer_boxes, [:trainer_id, :number], unique: true | 13 | add_index :boxes, [:trainer_id, :number], unique: true |
14 | end | 14 | end |
15 | end | 15 | end |
diff --git a/db/migrate/20170925013807_create_pokeviewer_locations.rb b/db/migrate/20170925013807_create_pokeviewer_locations.rb index 9070077..ffd4c15 100644 --- a/db/migrate/20170925013807_create_pokeviewer_locations.rb +++ b/db/migrate/20170925013807_create_pokeviewer_locations.rb | |||
@@ -1,6 +1,6 @@ | |||
1 | class CreatePokeviewerLocations < ActiveRecord::Migration[5.1] | 1 | class CreatePokeviewerLocations < ActiveRecord::Migration[5.1] |
2 | def change | 2 | def change |
3 | create_table :pokeviewer_locations do |t| | 3 | create_table :locations do |t| |
4 | t.string :name, null: false | 4 | t.string :name, null: false |
5 | 5 | ||
6 | t.timestamps | 6 | t.timestamps |
diff --git a/db/migrate/20170929211529_add_ribbons_to_revision.rb b/db/migrate/20170929211529_add_ribbons_to_revision.rb index 1dc93c1..0fb8037 100644 --- a/db/migrate/20170929211529_add_ribbons_to_revision.rb +++ b/db/migrate/20170929211529_add_ribbons_to_revision.rb | |||
@@ -1,6 +1,6 @@ | |||
1 | class AddRibbonsToRevision < ActiveRecord::Migration[5.1] | 1 | class AddRibbonsToRevision < ActiveRecord::Migration[5.1] |
2 | def change | 2 | def change |
3 | change_table :pokeviewer_revisions do |t| | 3 | change_table :revisions do |t| |
4 | t.integer :cool_ribbons, null: false, default: 0 | 4 | t.integer :cool_ribbons, null: false, default: 0 |
5 | t.integer :beauty_ribbons, null: false, default: 0 | 5 | t.integer :beauty_ribbons, null: false, default: 0 |
6 | t.integer :cute_ribbons, null: false, default: 0 | 6 | t.integer :cute_ribbons, null: false, default: 0 |
diff --git a/db/migrate/20170929221317_create_pokeviewer_gift_ribbons.rb b/db/migrate/20170929221317_create_pokeviewer_gift_ribbons.rb index deedc80..fac7635 100644 --- a/db/migrate/20170929221317_create_pokeviewer_gift_ribbons.rb +++ b/db/migrate/20170929221317_create_pokeviewer_gift_ribbons.rb | |||
@@ -1,6 +1,6 @@ | |||
1 | class CreatePokeviewerGiftRibbons < ActiveRecord::Migration[5.1] | 1 | class CreatePokeviewerGiftRibbons < ActiveRecord::Migration[5.1] |
2 | def change | 2 | def change |
3 | create_table :pokeviewer_gift_ribbons do |t| | 3 | create_table :gift_ribbons do |t| |
4 | t.string :description, null: false | 4 | t.string :description, null: false |
5 | 5 | ||
6 | t.timestamps | 6 | t.timestamps |
diff --git a/db/migrate/20170930021856_add_gift_ribbons_to_trainer.rb b/db/migrate/20170930021856_add_gift_ribbons_to_trainer.rb index 2a5f9b3..ed15ea1 100644 --- a/db/migrate/20170930021856_add_gift_ribbons_to_trainer.rb +++ b/db/migrate/20170930021856_add_gift_ribbons_to_trainer.rb | |||
@@ -1,6 +1,6 @@ | |||
1 | class AddGiftRibbonsToTrainer < ActiveRecord::Migration[5.1] | 1 | class AddGiftRibbonsToTrainer < ActiveRecord::Migration[5.1] |
2 | def change | 2 | def change |
3 | change_table :pokeviewer_trainers do |t| | 3 | change_table :trainers do |t| |
4 | t.references :marine_ribbon, null: true | 4 | t.references :marine_ribbon, null: true |
5 | t.references :land_ribbon, null: true | 5 | t.references :land_ribbon, null: true |
6 | t.references :sky_ribbon, null: true | 6 | t.references :sky_ribbon, null: true |
@@ -10,25 +10,25 @@ class AddGiftRibbonsToTrainer < ActiveRecord::Migration[5.1] | |||
10 | t.references :world_ribbon, null: true | 10 | t.references :world_ribbon, null: true |
11 | end | 11 | end |
12 | 12 | ||
13 | add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, | 13 | add_foreign_key :trainers, :gift_ribbons, |
14 | column: :marine_ribbon_id | 14 | column: :marine_ribbon_id |
15 | 15 | ||
16 | add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, | 16 | add_foreign_key :trainers, :gift_ribbons, |
17 | column: :land_ribbon_id | 17 | column: :land_ribbon_id |
18 | 18 | ||
19 | add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, | 19 | add_foreign_key :trainers, :gift_ribbons, |
20 | column: :sky_ribbon_id | 20 | column: :sky_ribbon_id |
21 | 21 | ||
22 | add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, | 22 | add_foreign_key :trainers, :gift_ribbons, |
23 | column: :country_ribbon_id | 23 | column: :country_ribbon_id |
24 | 24 | ||
25 | add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, | 25 | add_foreign_key :trainers, :gift_ribbons, |
26 | column: :national_ribbon_id | 26 | column: :national_ribbon_id |
27 | 27 | ||
28 | add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, | 28 | add_foreign_key :trainers, :gift_ribbons, |
29 | column: :earth_ribbon_id | 29 | column: :earth_ribbon_id |
30 | 30 | ||
31 | add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons, | 31 | add_foreign_key :trainers, :gift_ribbons, |
32 | column: :world_ribbon_id | 32 | column: :world_ribbon_id |
33 | end | 33 | end |
34 | end | 34 | end |
diff --git a/db/migrate/20170930185514_create_pokeviewer_items.rb b/db/migrate/20170930185514_create_pokeviewer_items.rb index 82cf3c2..4ef9c64 100644 --- a/db/migrate/20170930185514_create_pokeviewer_items.rb +++ b/db/migrate/20170930185514_create_pokeviewer_items.rb | |||
@@ -1,6 +1,6 @@ | |||
1 | class CreatePokeviewerItems < ActiveRecord::Migration[5.1] | 1 | class CreatePokeviewerItems < ActiveRecord::Migration[5.1] |
2 | def change | 2 | def change |
3 | create_table :pokeviewer_items do |t| | 3 | create_table :items do |t| |
4 | t.string :name, null: false | 4 | t.string :name, null: false |
5 | t.boolean :tm, null: false, default: false | 5 | t.boolean :tm, null: false, default: false |
6 | t.references :move, null: true | 6 | t.references :move, null: true |
@@ -11,6 +11,6 @@ class CreatePokeviewerItems < ActiveRecord::Migration[5.1] | |||
11 | t.timestamps | 11 | t.timestamps |
12 | end | 12 | end |
13 | 13 | ||
14 | add_foreign_key :pokeviewer_items, :pokeviewer_moves, column: :move_id | 14 | add_foreign_key :items, :moves, column: :move_id |
15 | end | 15 | end |
16 | end | 16 | end |
diff --git a/db/migrate/20170930190647_add_description_and_type_to_moves.rb b/db/migrate/20170930190647_add_description_and_type_to_moves.rb index d2fe032..e6316fd 100644 --- a/db/migrate/20170930190647_add_description_and_type_to_moves.rb +++ b/db/migrate/20170930190647_add_description_and_type_to_moves.rb | |||
@@ -1,14 +1,14 @@ | |||
1 | class AddDescriptionAndTypeToMoves < ActiveRecord::Migration[5.1] | 1 | class AddDescriptionAndTypeToMoves < ActiveRecord::Migration[5.1] |
2 | def change | 2 | def change |
3 | change_table :pokeviewer_moves do |t| | 3 | change_table :moves do |t| |
4 | t.string :move_type, null: false, default: "" | 4 | t.string :move_type, null: false, default: "" |
5 | t.string :rs_description, null: false, default: "" | 5 | t.string :rs_description, null: false, default: "" |
6 | t.string :frlg_description, null: false, default: "" | 6 | t.string :frlg_description, null: false, default: "" |
7 | t.string :emerald_description | 7 | t.string :emerald_description |
8 | end | 8 | end |
9 | 9 | ||
10 | change_column_default :pokeviewer_moves, :move_type, nil | 10 | change_column_default :moves, :move_type, nil |
11 | change_column_default :pokeviewer_moves, :rs_description, nil | 11 | change_column_default :moves, :rs_description, nil |
12 | change_column_default :pokeviewer_moves, :frlg_description, nil | 12 | change_column_default :moves, :frlg_description, nil |
13 | end | 13 | end |
14 | end | 14 | end |
diff --git a/db/migrate/20170930213633_rename_revision_hold_item.rb b/db/migrate/20170930213633_rename_revision_hold_item.rb index fe5ce9d..4060b9b 100644 --- a/db/migrate/20170930213633_rename_revision_hold_item.rb +++ b/db/migrate/20170930213633_rename_revision_hold_item.rb | |||
@@ -1,11 +1,11 @@ | |||
1 | class RenameRevisionHoldItem < ActiveRecord::Migration[5.1] | 1 | class RenameRevisionHoldItem < ActiveRecord::Migration[5.1] |
2 | def change | 2 | def change |
3 | remove_column :pokeviewer_revisions, :hold_item, :integer | 3 | remove_column :revisions, :hold_item, :integer |
4 | 4 | ||
5 | change_table :pokeviewer_revisions do |t| | 5 | change_table :revisions do |t| |
6 | t.references :item | 6 | t.references :item |
7 | end | 7 | end |
8 | 8 | ||
9 | add_foreign_key :pokeviewer_revisions, :pokeviewer_items, column: :item_id | 9 | add_foreign_key :revisions, :items, column: :item_id |
10 | end | 10 | end |
11 | end | 11 | end |
diff --git a/db/migrate/20171003154157_rename_pokemon_met_location.rb b/db/migrate/20171003154157_rename_pokemon_met_location.rb index 3d42d53..7fc46e6 100644 --- a/db/migrate/20171003154157_rename_pokemon_met_location.rb +++ b/db/migrate/20171003154157_rename_pokemon_met_location.rb | |||
@@ -1,10 +1,10 @@ | |||
1 | class RenamePokemonMetLocation < ActiveRecord::Migration[5.1] | 1 | class RenamePokemonMetLocation < ActiveRecord::Migration[5.1] |
2 | def up | 2 | def up |
3 | change_table :pokeviewer_pokemon do |t| | 3 | change_table :pokemon do |t| |
4 | t.references :location, null: true | 4 | t.references :location, null: true |
5 | end | 5 | end |
6 | 6 | ||
7 | add_foreign_key :pokeviewer_pokemon, :pokeviewer_locations, | 7 | add_foreign_key :pokemon, :locations, |
8 | column: :location_id | 8 | column: :location_id |
9 | 9 | ||
10 | Pokeviewer::Pokemon.all.each do |p| | 10 | Pokeviewer::Pokemon.all.each do |p| |
@@ -14,11 +14,11 @@ class RenamePokemonMetLocation < ActiveRecord::Migration[5.1] | |||
14 | end | 14 | end |
15 | end | 15 | end |
16 | 16 | ||
17 | remove_column :pokeviewer_pokemon, :met_location | 17 | remove_column :pokemon, :met_location |
18 | end | 18 | end |
19 | 19 | ||
20 | def down | 20 | def down |
21 | add_column :pokeviewer_pokemon, :met_location, :string | 21 | add_column :pokemon, :met_location, :string |
22 | 22 | ||
23 | Pokeviewer::Pokemon.all.each do |p| | 23 | Pokeviewer::Pokemon.all.each do |p| |
24 | unless p.location_id.nil? | 24 | unless p.location_id.nil? |
@@ -27,6 +27,6 @@ class RenamePokemonMetLocation < ActiveRecord::Migration[5.1] | |||
27 | end | 27 | end |
28 | end | 28 | end |
29 | 29 | ||
30 | remove_column :pokeviewer_pokemon, :location_id | 30 | remove_column :pokemon, :location_id |
31 | end | 31 | end |
32 | end | 32 | end |
diff --git a/db/migrate/20171003191205_remove_boxes.rb b/db/migrate/20171003191205_remove_boxes.rb index 476b98a..f7258fd 100644 --- a/db/migrate/20171003191205_remove_boxes.rb +++ b/db/migrate/20171003191205_remove_boxes.rb | |||
@@ -1,6 +1,6 @@ | |||
1 | class RemoveBoxes < ActiveRecord::Migration[5.1] | 1 | class RemoveBoxes < ActiveRecord::Migration[5.1] |
2 | def up | 2 | def up |
3 | change_table :pokeviewer_trainers do |t| | 3 | change_table :trainers do |t| |
4 | t.string :box_1_name, null: false, default: "" | 4 | t.string :box_1_name, null: false, default: "" |
5 | t.string :box_2_name, null: false, default: "" | 5 | t.string :box_2_name, null: false, default: "" |
6 | t.string :box_3_name, null: false, default: "" | 6 | t.string :box_3_name, null: false, default: "" |
@@ -17,24 +17,24 @@ class RemoveBoxes < ActiveRecord::Migration[5.1] | |||
17 | t.string :box_14_name, null: false, default: "" | 17 | t.string :box_14_name, null: false, default: "" |
18 | end | 18 | end |
19 | 19 | ||
20 | change_column_default :pokeviewer_trainers, :box_1_name, nil | 20 | change_column_default :trainers, :box_1_name, nil |
21 | change_column_default :pokeviewer_trainers, :box_2_name, nil | 21 | change_column_default :trainers, :box_2_name, nil |
22 | change_column_default :pokeviewer_trainers, :box_3_name, nil | 22 | change_column_default :trainers, :box_3_name, nil |
23 | change_column_default :pokeviewer_trainers, :box_4_name, nil | 23 | change_column_default :trainers, :box_4_name, nil |
24 | change_column_default :pokeviewer_trainers, :box_5_name, nil | 24 | change_column_default :trainers, :box_5_name, nil |
25 | change_column_default :pokeviewer_trainers, :box_6_name, nil | 25 | change_column_default :trainers, :box_6_name, nil |
26 | change_column_default :pokeviewer_trainers, :box_7_name, nil | 26 | change_column_default :trainers, :box_7_name, nil |
27 | change_column_default :pokeviewer_trainers, :box_8_name, nil | 27 | change_column_default :trainers, :box_8_name, nil |
28 | change_column_default :pokeviewer_trainers, :box_9_name, nil | 28 | change_column_default :trainers, :box_9_name, nil |
29 | change_column_default :pokeviewer_trainers, :box_10_name, nil | 29 | change_column_default :trainers, :box_10_name, nil |
30 | change_column_default :pokeviewer_trainers, :box_11_name, nil | 30 | change_column_default :trainers, :box_11_name, nil |
31 | change_column_default :pokeviewer_trainers, :box_12_name, nil | 31 | change_column_default :trainers, :box_12_name, nil |
32 | change_column_default :pokeviewer_trainers, :box_13_name, nil | 32 | change_column_default :trainers, :box_13_name, nil |
33 | change_column_default :pokeviewer_trainers, :box_14_name, nil | 33 | change_column_default :trainers, :box_14_name, nil |
34 | 34 | ||
35 | Pokeviewer::Trainer.all.each do |t| | 35 | Pokeviewer::Trainer.all.each do |t| |
36 | boxes = ActiveRecord::Base.connection.select_all( | 36 | boxes = ActiveRecord::Base.connection.select_all( |
37 | "SELECT * FROM pokeviewer_boxes WHERE trainer_id = ? ORDER BY number ASC", | 37 | "SELECT * FROM boxes WHERE trainer_id = ? ORDER BY number ASC", |
38 | t.trainer_id).map { |b| b["name"] } | 38 | t.trainer_id).map { |b| b["name"] } |
39 | 39 | ||
40 | t.box_1_name = boxes.shift | 40 | t.box_1_name = boxes.shift |
@@ -55,11 +55,11 @@ class RemoveBoxes < ActiveRecord::Migration[5.1] | |||
55 | t.save | 55 | t.save |
56 | end | 56 | end |
57 | 57 | ||
58 | drop_table :pokeviewer_boxes | 58 | drop_table :boxes |
59 | end | 59 | end |
60 | 60 | ||
61 | def down | 61 | def down |
62 | create_table :pokeviewer_boxes do |t| | 62 | create_table :boxes do |t| |
63 | t.integer "trainer_id", null: false | 63 | t.integer "trainer_id", null: false |
64 | t.integer "number", null: false | 64 | t.integer "number", null: false |
65 | t.string "name", null: false | 65 | t.string "name", null: false |
@@ -67,9 +67,9 @@ class RemoveBoxes < ActiveRecord::Migration[5.1] | |||
67 | t.timestamps | 67 | t.timestamps |
68 | end | 68 | end |
69 | 69 | ||
70 | add_index :pokeviewer_boxes, [:trainer_id, :number], unique: true | 70 | add_index :boxes, [:trainer_id, :number], unique: true |
71 | 71 | ||
72 | add_foreign_key :pokeviewer_boxes, :pokeviewer_trainers, column: :trainer_id | 72 | add_foreign_key :boxes, :trainers, column: :trainer_id |
73 | 73 | ||
74 | Pokeviewer::Trainer.all.each do |t| | 74 | Pokeviewer::Trainer.all.each do |t| |
75 | Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 1, name: t.box_1_name) | 75 | Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 1, name: t.box_1_name) |
@@ -88,19 +88,19 @@ class RemoveBoxes < ActiveRecord::Migration[5.1] | |||
88 | Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 14, name: t.box_14_name) | 88 | Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 14, name: t.box_14_name) |
89 | end | 89 | end |
90 | 90 | ||
91 | remove_column :pokeviewer_trainers, :box_1_name | 91 | remove_column :trainers, :box_1_name |
92 | remove_column :pokeviewer_trainers, :box_2_name | 92 | remove_column :trainers, :box_2_name |
93 | remove_column :pokeviewer_trainers, :box_3_name | 93 | remove_column :trainers, :box_3_name |
94 | remove_column :pokeviewer_trainers, :box_4_name | 94 | remove_column :trainers, :box_4_name |
95 | remove_column :pokeviewer_trainers, :box_5_name | 95 | remove_column :trainers, :box_5_name |
96 | remove_column :pokeviewer_trainers, :box_6_name | 96 | remove_column :trainers, :box_6_name |
97 | remove_column :pokeviewer_trainers, :box_7_name | 97 | remove_column :trainers, :box_7_name |
98 | remove_column :pokeviewer_trainers, :box_8_name | 98 | remove_column :trainers, :box_8_name |
99 | remove_column :pokeviewer_trainers, :box_9_name | 99 | remove_column :trainers, :box_9_name |
100 | remove_column :pokeviewer_trainers, :box_10_name | 100 | remove_column :trainers, :box_10_name |
101 | remove_column :pokeviewer_trainers, :box_11_name | 101 | remove_column :trainers, :box_11_name |
102 | remove_column :pokeviewer_trainers, :box_12_name | 102 | remove_column :trainers, :box_12_name |
103 | remove_column :pokeviewer_trainers, :box_13_name | 103 | remove_column :trainers, :box_13_name |
104 | remove_column :pokeviewer_trainers, :box_14_name | 104 | remove_column :trainers, :box_14_name |
105 | end | 105 | end |
106 | end | 106 | end |
diff --git a/db/migrate/20171004203404_add_pokeball_to_pokemon.rb b/db/migrate/20171004203404_add_pokeball_to_pokemon.rb index 9568d10..d66a4ca 100644 --- a/db/migrate/20171004203404_add_pokeball_to_pokemon.rb +++ b/db/migrate/20171004203404_add_pokeball_to_pokemon.rb | |||
@@ -1,9 +1,9 @@ | |||
1 | class AddPokeballToPokemon < ActiveRecord::Migration[5.1] | 1 | class AddPokeballToPokemon < ActiveRecord::Migration[5.1] |
2 | def change | 2 | def change |
3 | change_table :pokeviewer_pokemon do |t| | 3 | change_table :pokemon do |t| |
4 | t.string :pokeball, null: false, default: :poke | 4 | t.string :pokeball, null: false, default: :poke |
5 | end | 5 | end |
6 | 6 | ||
7 | change_column_default :pokeviewer_pokemon, :pokeball, nil | 7 | change_column_default :pokemon, :pokeball, nil |
8 | end | 8 | end |
9 | end | 9 | end |
diff --git a/db/migrate/20171011015325_create_pokeviewer_abilities.rb b/db/migrate/20171011015325_create_pokeviewer_abilities.rb index a7f6b5f..ae9645d 100644 --- a/db/migrate/20171011015325_create_pokeviewer_abilities.rb +++ b/db/migrate/20171011015325_create_pokeviewer_abilities.rb | |||
@@ -1,12 +1,12 @@ | |||
1 | class CreatePokeviewerAbilities < ActiveRecord::Migration[5.1] | 1 | class CreatePokeviewerAbilities < ActiveRecord::Migration[5.1] |
2 | def change | 2 | def change |
3 | create_table :pokeviewer_abilities do |t| | 3 | create_table :abilities do |t| |
4 | t.string :name, null: false, limit: 191 | 4 | t.string :name, null: false, limit: 191 |
5 | t.string :description, null: false | 5 | t.string :description, null: false |
6 | 6 | ||
7 | t.timestamps | 7 | t.timestamps |
8 | end | 8 | end |
9 | 9 | ||
10 | add_index :pokeviewer_abilities, :name, unique: true | 10 | add_index :abilities, :name, unique: true |
11 | end | 11 | end |
12 | end | 12 | end |
diff --git a/db/migrate/20171011015648_add_type_and_ability_to_species.rb b/db/migrate/20171011015648_add_type_and_ability_to_species.rb index 3c24c1b..8a66d8c 100644 --- a/db/migrate/20171011015648_add_type_and_ability_to_species.rb +++ b/db/migrate/20171011015648_add_type_and_ability_to_species.rb | |||
@@ -1,19 +1,19 @@ | |||
1 | class AddTypeAndAbilityToSpecies < ActiveRecord::Migration[5.1] | 1 | class AddTypeAndAbilityToSpecies < ActiveRecord::Migration[5.1] |
2 | def change | 2 | def change |
3 | change_table :pokeviewer_species do |t| | 3 | change_table :species do |t| |
4 | t.string :type_1, null: false, default: "" | 4 | t.string :type_1, null: false, default: "" |
5 | t.string :type_2 | 5 | t.string :type_2 |
6 | t.references :ability_1, null: false, default: 0 | 6 | t.references :ability_1, null: false, default: 0 |
7 | t.references :ability_2 | 7 | t.references :ability_2 |
8 | end | 8 | end |
9 | 9 | ||
10 | change_column_default :pokeviewer_species, :type_1, nil | 10 | change_column_default :species, :type_1, nil |
11 | change_column_default :pokeviewer_species, :ability_1_id, nil | 11 | change_column_default :species, :ability_1_id, nil |
12 | 12 | ||
13 | add_foreign_key :pokeviewer_species, :pokeviewer_abilities, | 13 | add_foreign_key :species, :abilities, |
14 | column: :ability_1_id | 14 | column: :ability_1_id |
15 | 15 | ||
16 | add_foreign_key :pokeviewer_species, :pokeviewer_abilities, | 16 | add_foreign_key :species, :abilities, |
17 | column: :ability_2_id | 17 | column: :ability_2_id |
18 | end | 18 | end |
19 | end | 19 | end |
diff --git a/db/migrate/20180113200119_move_species_to_revision.rb b/db/migrate/20180113200119_move_species_to_revision.rb index 8b94d48..9f84c51 100644 --- a/db/migrate/20180113200119_move_species_to_revision.rb +++ b/db/migrate/20180113200119_move_species_to_revision.rb | |||
@@ -1,6 +1,6 @@ | |||
1 | class MoveSpeciesToRevision < ActiveRecord::Migration[5.1] | 1 | class MoveSpeciesToRevision < ActiveRecord::Migration[5.1] |
2 | def up | 2 | def up |
3 | change_table :pokeviewer_revisions do |t| | 3 | change_table :revisions do |t| |
4 | t.references :species, null: true | 4 | t.references :species, null: true |
5 | end | 5 | end |
6 | 6 | ||
@@ -9,17 +9,17 @@ class MoveSpeciesToRevision < ActiveRecord::Migration[5.1] | |||
9 | r.save! | 9 | r.save! |
10 | end | 10 | end |
11 | 11 | ||
12 | remove_column :pokeviewer_pokemon, :species_id | 12 | remove_column :pokemon, :species_id |
13 | 13 | ||
14 | change_column_null :pokeviewer_revisions, :species_id, false | 14 | change_column_null :revisions, :species_id, false |
15 | 15 | ||
16 | add_foreign_key :pokeviewer_revisions, :pokeviewer_species, | 16 | add_foreign_key :revisions, :species, |
17 | column: :species_id | 17 | column: :species_id |
18 | end | 18 | end |
19 | 19 | ||
20 | def down | 20 | def down |
21 | def up | 21 | def up |
22 | change_table :pokeviewer_pokemon do |t| | 22 | change_table :pokemon do |t| |
23 | t.references :species, null: true | 23 | t.references :species, null: true |
24 | end | 24 | end |
25 | 25 | ||
@@ -28,11 +28,11 @@ class MoveSpeciesToRevision < ActiveRecord::Migration[5.1] | |||
28 | p.save! | 28 | p.save! |
29 | end | 29 | end |
30 | 30 | ||
31 | remove_column :pokeviewer_revisions, :species_id | 31 | remove_column :revisions, :species_id |
32 | 32 | ||
33 | change_column_null :pokeviewer_pokemon, :species_id, false | 33 | change_column_null :pokemon, :species_id, false |
34 | 34 | ||
35 | add_foreign_key :pokeviewer_pokemon, :pokeviewer_species, | 35 | add_foreign_key :pokemon, :species, |
36 | column: :species_id | 36 | column: :species_id |
37 | end | 37 | end |
38 | end | 38 | end |
diff --git a/db/migrate/20180114170238_cache_current_pokemon_revision.rb b/db/migrate/20180114170238_cache_current_pokemon_revision.rb index a0e1747..8b1d6ff 100644 --- a/db/migrate/20180114170238_cache_current_pokemon_revision.rb +++ b/db/migrate/20180114170238_cache_current_pokemon_revision.rb | |||
@@ -1,10 +1,10 @@ | |||
1 | class CacheCurrentPokemonRevision < ActiveRecord::Migration[5.1] | 1 | class CacheCurrentPokemonRevision < ActiveRecord::Migration[5.1] |
2 | def up | 2 | def up |
3 | change_table :pokeviewer_pokemon do |t| | 3 | change_table :pokemon do |t| |
4 | t.references :current, null: true | 4 | t.references :current, null: true |
5 | end | 5 | end |
6 | 6 | ||
7 | add_foreign_key :pokeviewer_pokemon, :pokeviewer_revisions, | 7 | add_foreign_key :pokemon, :revisions, |
8 | column: :current_id | 8 | column: :current_id |
9 | 9 | ||
10 | Pokeviewer::Pokemon.all.each do |p| | 10 | Pokeviewer::Pokemon.all.each do |p| |
@@ -14,6 +14,6 @@ class CacheCurrentPokemonRevision < ActiveRecord::Migration[5.1] | |||
14 | end | 14 | end |
15 | 15 | ||
16 | def down | 16 | def down |
17 | remove_column :pokeviewer_pokemon, :current_id | 17 | remove_column :pokemon, :current_id |
18 | end | 18 | end |
19 | end | 19 | end |
diff --git a/db/migrate/20180129213822_create_pokeviewer_pokedex_entries.rb b/db/migrate/20180129213822_create_pokeviewer_pokedex_entries.rb index 8456456..a6f1bec 100644 --- a/db/migrate/20180129213822_create_pokeviewer_pokedex_entries.rb +++ b/db/migrate/20180129213822_create_pokeviewer_pokedex_entries.rb | |||
@@ -1,6 +1,6 @@ | |||
1 | class CreatePokeviewerPokedexEntries < ActiveRecord::Migration[5.1] | 1 | class CreatePokeviewerPokedexEntries < ActiveRecord::Migration[5.1] |
2 | def change | 2 | def change |
3 | create_table :pokeviewer_pokedex_entries do |t| | 3 | create_table :pokedex_entries do |t| |
4 | t.references :trainer, null: true | 4 | t.references :trainer, null: true |
5 | t.references :species, null: true | 5 | t.references :species, null: true |
6 | t.boolean :caught, null: true, default: false | 6 | t.boolean :caught, null: true, default: false |
@@ -8,13 +8,13 @@ class CreatePokeviewerPokedexEntries < ActiveRecord::Migration[5.1] | |||
8 | t.timestamps | 8 | t.timestamps |
9 | end | 9 | end |
10 | 10 | ||
11 | add_foreign_key :pokeviewer_pokedex_entries, :pokeviewer_trainers, | 11 | add_foreign_key :pokedex_entries, :trainers, |
12 | column: :trainer_id | 12 | column: :trainer_id |
13 | 13 | ||
14 | add_foreign_key :pokeviewer_pokedex_entries, :pokeviewer_species, | 14 | add_foreign_key :pokedex_entries, :species, |
15 | column: :species_id | 15 | column: :species_id |
16 | 16 | ||
17 | add_index :pokeviewer_pokedex_entries, [:trainer_id, :species_id], | 17 | add_index :pokedex_entries, [:trainer_id, :species_id], |
18 | unique: true | 18 | unique: true |
19 | end | 19 | end |
20 | end | 20 | end |