about summary refs log tree commit diff stats
path: root/db/migrate/20170917011258_create_pokeviewer_revision_moves.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20170917011258_create_pokeviewer_revision_moves.rb')
-rw-r--r--db/migrate/20170917011258_create_pokeviewer_revision_moves.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/db/migrate/20170917011258_create_pokeviewer_revision_moves.rb b/db/migrate/20170917011258_create_pokeviewer_revision_moves.rb new file mode 100644 index 0000000..e061207 --- /dev/null +++ b/db/migrate/20170917011258_create_pokeviewer_revision_moves.rb
@@ -0,0 +1,20 @@
1class CreatePokeviewerRevisionMoves < ActiveRecord::Migration[5.1]
2 def change
3 create_table :pokeviewer_revision_moves do |t|
4 t.references :revision, null: false
5 t.references :move, null: false
6 t.integer :number, null: false
7 t.integer :pp_bonuses, null: false, default: 0
8
9 t.timestamps
10 end
11
12 add_index :pokeviewer_revision_moves, [:revision_id, :number], unique: true
13
14 add_foreign_key :pokeviewer_revision_moves, :pokeviewer_revisions,
15 column: :revision_id
16
17 add_foreign_key :pokeviewer_revision_moves, :pokeviewer_moves,
18 column: :move_id
19 end
20end