diff options
Diffstat (limited to 'db/migrate/20180130021851_create_pokeviewer_pokedex_entries.pokeviewer.rb')
-rw-r--r-- | db/migrate/20180130021851_create_pokeviewer_pokedex_entries.pokeviewer.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/db/migrate/20180130021851_create_pokeviewer_pokedex_entries.pokeviewer.rb b/db/migrate/20180130021851_create_pokeviewer_pokedex_entries.pokeviewer.rb new file mode 100644 index 0000000..2451ef2 --- /dev/null +++ b/db/migrate/20180130021851_create_pokeviewer_pokedex_entries.pokeviewer.rb | |||
@@ -0,0 +1,21 @@ | |||
1 | # This migration comes from pokeviewer (originally 20180129213822) | ||
2 | class CreatePokeviewerPokedexEntries < ActiveRecord::Migration[5.1] | ||
3 | def change | ||
4 | create_table :pokeviewer_pokedex_entries do |t| | ||
5 | t.references :trainer, null: true | ||
6 | t.references :species, null: true | ||
7 | t.boolean :caught, null: true, default: false | ||
8 | |||
9 | t.timestamps | ||
10 | end | ||
11 | |||
12 | add_foreign_key :pokeviewer_pokedex_entries, :pokeviewer_trainers, | ||
13 | column: :trainer_id | ||
14 | |||
15 | add_foreign_key :pokeviewer_pokedex_entries, :pokeviewer_species, | ||
16 | column: :species_id | ||
17 | |||
18 | add_index :pokeviewer_pokedex_entries, [:trainer_id, :species_id], | ||
19 | unique: true | ||
20 | end | ||
21 | end | ||