blob: a6f1bec8a471def9687479e61eae6a9fbd6798df (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
class CreatePokeviewerPokedexEntries < ActiveRecord::Migration[5.1]
def change
create_table :pokedex_entries do |t|
t.references :trainer, null: true
t.references :species, null: true
t.boolean :caught, null: true, default: false
t.timestamps
end
add_foreign_key :pokedex_entries, :trainers,
column: :trainer_id
add_foreign_key :pokedex_entries, :species,
column: :species_id
add_index :pokedex_entries, [:trainer_id, :species_id],
unique: true
end
end
|