about summary refs log tree commit diff stats
path: root/db/migrate/20171015171541_create_pokeviewer_pokemon.pokeviewer.rb
blob: dd14d8c4e625e5c8ac47d0132b1cc00767b3a6f1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# This migration comes from pokeviewer (originally 20170916234251)
class CreatePokeviewerPokemon < ActiveRecord::Migration[5.1]
  def change
    create_table :pokeviewer_pokemon do |t|
      t.string :uuid, null: false, limit: 191
      t.references :species, null: false
      t.references :trainer, null: true
      t.string :key, null: true, limit: 191
      t.string :ot_name, null: false
      t.integer :ot_number, null: false
      t.string :met_type, null: false
      t.string :met_location, null: true
      t.integer :met_level, null: false
      t.boolean :shiny, null: false, default: false
      t.string :nature, null: false
      t.string :gender, null: false
      t.boolean :second_ability, null: false
      t.string :unown_letter, null: true, limit: 1

      t.timestamps
    end

    add_index :pokeviewer_pokemon, :uuid, unique: true
    add_index :pokeviewer_pokemon, :key, unique: true

    add_foreign_key :pokeviewer_pokemon, :pokeviewer_species,
      column: :species_id

    add_foreign_key :pokeviewer_pokemon, :pokeviewer_trainers,
      column: :trainer_id
  end
end