Class: CreateTableAwardedBadges

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/templates/db/migrate/create_table_awarded_badges.rb

Instance Method Summary collapse

Instance Method Details

#changeObject



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/generators/templates/db/migrate/create_table_awarded_badges.rb', line 2

def change
  create_table :awarded_badges do |t|
    t.integer :awardee_id  
    t.string  :awardee_type  
    t.string  :badge_code
    t.timestamps
  end

  add_index :awarded_badges, [:awardee_id, :awardee_type, :badge_code], 
            unique: true, name: "awarded_badges_awardee_badge_index"
end