2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-31 00:06:56 -04:00
|
|
|
class CreateUserBadges < ActiveRecord::Migration[4.2]
|
2014-03-05 07:52:20 -05:00
|
|
|
def change
|
|
|
|
create_table :user_badges do |t|
|
|
|
|
t.integer :badge_id, null: false
|
|
|
|
t.integer :user_id, index: true, null: false
|
|
|
|
t.datetime :granted_at, null: false
|
|
|
|
t.integer :granted_by_id, null: false
|
|
|
|
end
|
|
|
|
|
|
|
|
add_index :user_badges, %i[badge_id user_id], unique: true
|
|
|
|
end
|
|
|
|
end
|