about summary refs log tree commit diff stats
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20170917011258_create_pokeviewer_revision_moves.rb20
-rw-r--r--db/migrate/20170917011258_create_pokeviewer_revisions.rb (renamed from db/migrate/20170917002857_create_pokeviewer_revisions.rb)20
2 files changed, 20 insertions, 20 deletions
diff --git a/db/migrate/20170917011258_create_pokeviewer_revision_moves.rb b/db/migrate/20170917011258_create_pokeviewer_revision_moves.rb deleted file mode 100644 index e061207..0000000 --- a/db/migrate/20170917011258_create_pokeviewer_revision_moves.rb +++ /dev/null
@@ -1,20 +0,0 @@
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
diff --git a/db/migrate/20170917002857_create_pokeviewer_revisions.rb b/db/migrate/20170917011258_create_pokeviewer_revisions.rb index f6755da..faa3532 100644 --- a/db/migrate/20170917002857_create_pokeviewer_revisions.rb +++ b/db/migrate/20170917011258_create_pokeviewer_revisions.rb
@@ -19,6 +19,14 @@ class CreatePokeviewerRevisions < ActiveRecord::Migration[5.1]
19 t.integer :toughness, null: false 19 t.integer :toughness, null: false
20 t.integer :sheen, null: false 20 t.integer :sheen, null: false
21 t.integer :hold_item, null: true 21 t.integer :hold_item, null: true
22 t.references :move_1, null: false
23 t.references :move_2, null: true
24 t.references :move_3, null: true
25 t.references :move_4, null: true
26 t.integer :move_1_pp_bonuses, null: false, default: 0
27 t.integer :move_2_pp_bonuses, null: false, default: 0
28 t.integer :move_3_pp_bonuses, null: false, default: 0
29 t.integer :move_4_pp_bonuses, null: false, default: 0
22 30
23 t.timestamps 31 t.timestamps
24 end 32 end
@@ -27,5 +35,17 @@ class CreatePokeviewerRevisions < ActiveRecord::Migration[5.1]
27 35
28 add_foreign_key :pokeviewer_revisions, :pokewalker_pokemon, 36 add_foreign_key :pokeviewer_revisions, :pokewalker_pokemon,
29 column: :pokemon_id 37 column: :pokemon_id
38
39 add_foreign_key :pokeviewer_revisions, :pokewalker_moves,
40 column: :move_1_id
41
42 add_foreign_key :pokeviewer_revisions, :pokewalker_moves,
43 column: :move_2_id
44
45 add_foreign_key :pokeviewer_revisions, :pokewalker_moves,
46 column: :move_3_id
47
48 add_foreign_key :pokeviewer_revisions, :pokewalker_moves,
49 column: :move_4_id
30 end 50 end
31end 51end