about summary refs log tree commit diff stats
path: root/db/migrate/20170930021856_add_gift_ribbons_to_trainer.rb
blob: 2a5f9b3f69de341a8021df9ede948148099cb799 (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
33
34
class AddGiftRibbonsToTrainer < ActiveRecord::Migration[5.1]
  def change
    change_table :pokeviewer_trainers do |t|
      t.references :marine_ribbon, null: true
      t.references :land_ribbon, null: true
      t.references :sky_ribbon, null: true
      t.references :country_ribbon, null: true
      t.references :national_ribbon, null: true
      t.references :earth_ribbon, null: true
      t.references :world_ribbon, null: true
    end

    add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons,
      column: :marine_ribbon_id

    add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons,
      column: :land_ribbon_id

    add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons,
      column: :sky_ribbon_id

    add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons,
      column: :country_ribbon_id

    add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons,
      column: :national_ribbon_id

    add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons,
      column: :earth_ribbon_id

    add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons,
      column: :world_ribbon_id
  end
end