about summary refs log tree commit diff stats
path: root/db/migrate
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2017-10-10 22:46:46 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2017-10-10 22:46:46 -0400
commit0f32f526b73ecfd10012c0db9d7c4a4f15251a73 (patch)
treed456a80075b3a0680fa34214c51f47355ca24d43 /db/migrate
parent09ed6a6c7567bbd01dc236570982bf7ea31e11e6 (diff)
downloadpokeviewer-0f32f526b73ecfd10012c0db9d7c4a4f15251a73.tar.gz
pokeviewer-0f32f526b73ecfd10012c0db9d7c4a4f15251a73.tar.bz2
pokeviewer-0f32f526b73ecfd10012c0db9d7c4a4f15251a73.zip
Added type and ability data to species model
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20171011015325_create_pokeviewer_abilities.rb12
-rw-r--r--db/migrate/20171011015648_add_type_and_ability_to_species.rb19
2 files changed, 31 insertions, 0 deletions
diff --git a/db/migrate/20171011015325_create_pokeviewer_abilities.rb b/db/migrate/20171011015325_create_pokeviewer_abilities.rb new file mode 100644 index 0000000..a7f6b5f --- /dev/null +++ b/db/migrate/20171011015325_create_pokeviewer_abilities.rb
@@ -0,0 +1,12 @@
1class CreatePokeviewerAbilities < ActiveRecord::Migration[5.1]
2 def change
3 create_table :pokeviewer_abilities do |t|
4 t.string :name, null: false, limit: 191
5 t.string :description, null: false
6
7 t.timestamps
8 end
9
10 add_index :pokeviewer_abilities, :name, unique: true
11 end
12end
diff --git a/db/migrate/20171011015648_add_type_and_ability_to_species.rb b/db/migrate/20171011015648_add_type_and_ability_to_species.rb new file mode 100644 index 0000000..d7d274e --- /dev/null +++ b/db/migrate/20171011015648_add_type_and_ability_to_species.rb
@@ -0,0 +1,19 @@
1class AddTypeAndAbilityToSpecies < ActiveRecord::Migration[5.1]
2 def change
3 change_table :pokeviewer_species do |t|
4 t.string :type_1, null: false, default: ""
5 t.string :type_2
6 t.integer :ability_1_id, null: false, default: 0
7 t.integer :ability_2_id
8 end
9
10 change_column_default :pokeviewer_species, :type_1, nil
11 change_column_default :pokeviewer_species, :ability_1_id, nil
12
13 add_foreign_key :pokeviewer_species, :pokeviewer_abilities,
14 column: :ability_1_id
15
16 add_foreign_key :pokeviewer_species, :pokeviewer_abilities,
17 column: :ability_2_id
18 end
19end