about summary refs log tree commit diff stats
path: root/db/migrate/20171015171543_create_pokeviewer_revisions.pokeviewer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20171015171543_create_pokeviewer_revisions.pokeviewer.rb')
-rw-r--r--db/migrate/20171015171543_create_pokeviewer_revisions.pokeviewer.rb52
1 files changed, 52 insertions, 0 deletions
diff --git a/db/migrate/20171015171543_create_pokeviewer_revisions.pokeviewer.rb b/db/migrate/20171015171543_create_pokeviewer_revisions.pokeviewer.rb new file mode 100644 index 0000000..c44c227 --- /dev/null +++ b/db/migrate/20171015171543_create_pokeviewer_revisions.pokeviewer.rb
@@ -0,0 +1,52 @@
1# This migration comes from pokeviewer (originally 20170917011258)
2class CreatePokeviewerRevisions < ActiveRecord::Migration[5.1]
3 def change
4 create_table :pokeviewer_revisions do |t|
5 t.references :pokemon, null: false
6 t.integer :sequential_id, null: false
7 t.string :nickname, null: false
8 t.integer :experience, null: false
9 t.integer :level, null: false
10 t.integer :hp, null: false
11 t.integer :attack, null: false
12 t.integer :defense, null: false
13 t.integer :special_attack, null: false
14 t.integer :special_defense, null: false
15 t.integer :speed, null: false
16 t.integer :coolness, null: false
17 t.integer :beauty, null: false
18 t.integer :cuteness, null: false
19 t.integer :smartness, null: false
20 t.integer :toughness, null: false
21 t.integer :sheen, null: false
22 t.integer :hold_item, null: true
23 t.references :move_1, null: false
24 t.references :move_2, null: true
25 t.references :move_3, null: true
26 t.references :move_4, null: true
27 t.integer :move_1_pp_bonuses, null: false, default: 0
28 t.integer :move_2_pp_bonuses, null: false, default: 0
29 t.integer :move_3_pp_bonuses, null: false, default: 0
30 t.integer :move_4_pp_bonuses, null: false, default: 0
31
32 t.timestamps
33 end
34
35 add_index :pokeviewer_revisions, [:pokemon_id, :sequential_id], unique: true
36
37 add_foreign_key :pokeviewer_revisions, :pokewalker_pokemon,
38 column: :pokemon_id
39
40 add_foreign_key :pokeviewer_revisions, :pokewalker_moves,
41 column: :move_1_id
42
43 add_foreign_key :pokeviewer_revisions, :pokewalker_moves,
44 column: :move_2_id
45
46 add_foreign_key :pokeviewer_revisions, :pokewalker_moves,
47 column: :move_3_id
48
49 add_foreign_key :pokeviewer_revisions, :pokewalker_moves,
50 column: :move_4_id
51 end
52end