diff options
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20170924224550_create_pokeviewer_boxes.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/db/migrate/20170924224550_create_pokeviewer_boxes.rb b/db/migrate/20170924224550_create_pokeviewer_boxes.rb new file mode 100644 index 0000000..02f6fa9 --- /dev/null +++ b/db/migrate/20170924224550_create_pokeviewer_boxes.rb | |||
@@ -0,0 +1,15 @@ | |||
1 | class CreatePokeviewerBoxes < ActiveRecord::Migration[5.1] | ||
2 | def change | ||
3 | create_table :pokeviewer_boxes do |t| | ||
4 | t.references :trainer, null: false | ||
5 | t.integer :number, null: false | ||
6 | t.string :name, null: false | ||
7 | |||
8 | t.timestamps | ||
9 | end | ||
10 | |||
11 | add_foreign_key :pokeviewer_boxes, :pokeviewer_trainer, column: :trainer_id | ||
12 | |||
13 | add_index :pokeviewer_boxes, [:trainer_id, :number], unique: true | ||
14 | end | ||
15 | end | ||