about summary refs log tree commit diff stats
path: root/db/migrate/20171015171551_add_gift_ribbons_to_trainer.pokeviewer.rb
blob: 5bef8d56f70aa211a94192839cb3dae79dbeb97c (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
35
# This migration comes from pokeviewer (originally 20170930021856)
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