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/20170916225306_create_pokeviewer_trainers.rb13
-rw-r--r--db/migrate/20170916232015_create_pokeviewer_species.rb11
-rw-r--r--db/migrate/20170916234251_create_pokeviewer_pokemon.rb31
-rw-r--r--db/migrate/20170917002857_create_pokeviewer_revisions.rb31
-rw-r--r--db/migrate/20170917011102_create_pokeviewer_moves.rb12
-rw-r--r--db/migrate/20170917011258_create_pokeviewer_revision_moves.rb20
6 files changed, 118 insertions, 0 deletions
diff --git a/db/migrate/20170916225306_create_pokeviewer_trainers.rb b/db/migrate/20170916225306_create_pokeviewer_trainers.rb new file mode 100644 index 0000000..18e7952 --- /dev/null +++ b/db/migrate/20170916225306_create_pokeviewer_trainers.rb
@@ -0,0 +1,13 @@
1class CreatePokeviewerTrainers < ActiveRecord::Migration[5.1]
2 def change
3 create_table :pokeviewer_trainers do |t|
4 t.string :game, null: false
5 t.string :name, null: false, limit: 191
6 t.integer :number, null: false
7
8 t.timestamps
9 end
10
11 add_index :pokeviewer_trainers, [:name, :number], unique: true
12 end
13end
diff --git a/db/migrate/20170916232015_create_pokeviewer_species.rb b/db/migrate/20170916232015_create_pokeviewer_species.rb new file mode 100644 index 0000000..e6d5c09 --- /dev/null +++ b/db/migrate/20170916232015_create_pokeviewer_species.rb
@@ -0,0 +1,11 @@
1class CreatePokeviewerSpecies < ActiveRecord::Migration[5.1]
2 def change
3 create_table :pokeviewer_species do |t|
4 t.string :name, null: false, limit: 191
5
6 t.timestamps
7 end
8
9 add_index :pokeviewer_species, :name, unique: true
10 end
11end
diff --git a/db/migrate/20170916234251_create_pokeviewer_pokemon.rb b/db/migrate/20170916234251_create_pokeviewer_pokemon.rb new file mode 100644 index 0000000..dd9994c --- /dev/null +++ b/db/migrate/20170916234251_create_pokeviewer_pokemon.rb
@@ -0,0 +1,31 @@
1class CreatePokeviewerPokemon < ActiveRecord::Migration[5.1]
2 def change
3 create_table :pokeviewer_pokemon do |t|
4 t.string :uuid, null: false, limit: 191
5 t.references :species, null: false
6 t.references :trainer, null: true
7 t.string :key, null: true, limit: 191
8 t.string :ot_name, null: false
9 t.integer :ot_number, null: false
10 t.string :met_type, null: false
11 t.string :met_location, null: true
12 t.integer :met_level, null: false
13 t.boolean :shiny, null: false, default: false
14 t.string :nature, null: false
15 t.string :gender, null: false
16 t.boolean :second_ability, null: false
17 t.string :unown_letter, null: true, limit: 1
18
19 t.timestamps
20 end
21
22 add_index :pokeviewer_pokemon, :uuid, unique: true
23 add_index :pokeviewer_pokemon, :key, unique: true
24
25 add_foreign_key :pokeviewer_pokemon, :pokeviewer_species,
26 column: :species_id
27
28 add_foreign_key :pokeviewer_pokemon, :pokeviewer_trainer,
29 column: :trainer_id
30 end
31end
diff --git a/db/migrate/20170917002857_create_pokeviewer_revisions.rb b/db/migrate/20170917002857_create_pokeviewer_revisions.rb new file mode 100644 index 0000000..f6755da --- /dev/null +++ b/db/migrate/20170917002857_create_pokeviewer_revisions.rb
@@ -0,0 +1,31 @@
1class CreatePokeviewerRevisions < ActiveRecord::Migration[5.1]
2 def change
3 create_table :pokeviewer_revisions do |t|
4 t.references :pokemon, null: false
5 t.integer :sequential_id, null: false
6 t.string :nickname, null: false
7 t.integer :experience, null: false
8 t.integer :level, null: false
9 t.integer :hp, null: false
10 t.integer :attack, null: false
11 t.integer :defense, null: false
12 t.integer :special_attack, null: false
13 t.integer :special_defense, null: false
14 t.integer :speed, null: false
15 t.integer :coolness, null: false
16 t.integer :beauty, null: false
17 t.integer :cuteness, null: false
18 t.integer :smartness, null: false
19 t.integer :toughness, null: false
20 t.integer :sheen, null: false
21 t.integer :hold_item, null: true
22
23 t.timestamps
24 end
25
26 add_index :pokeviewer_revisions, [:pokemon_id, :sequential_id], unique: true
27
28 add_foreign_key :pokeviewer_revisions, :pokewalker_pokemon,
29 column: :pokemon_id
30 end
31end
diff --git a/db/migrate/20170917011102_create_pokeviewer_moves.rb b/db/migrate/20170917011102_create_pokeviewer_moves.rb new file mode 100644 index 0000000..86bf45f --- /dev/null +++ b/db/migrate/20170917011102_create_pokeviewer_moves.rb
@@ -0,0 +1,12 @@
1class CreatePokeviewerMoves < ActiveRecord::Migration[5.1]
2 def change
3 create_table :pokeviewer_moves do |t|
4 t.string :name, null: false, limit: 191
5 t.integer :pp, null: false
6
7 t.timestamps
8 end
9
10 add_index :pokeviewer_moves, :name, unique: true
11 end
12end
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