about summary refs log tree commit diff stats
path: root/db/migrate/20171015171547_create_pokeviewer_boxes.pokeviewer.rb
blob: 90323d183be9bc8c3fcb2ace6b6e10fd969449dc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# This migration comes from pokeviewer (originally 20170924224550)
class CreatePokeviewerBoxes < ActiveRecord::Migration[5.1]
  def change
    create_table :pokeviewer_boxes do |t|
      t.references :trainer, null: false
      t.integer :number, null: false
      t.string :name, null: false

      t.timestamps
    end

    add_foreign_key :pokeviewer_boxes, :pokeviewer_trainers, column: :trainer_id

    add_index :pokeviewer_boxes, [:trainer_id, :number], unique: true
  end
end