2013-06-25 08:00:20 +01:00
|
|
|
class CreateTokens < ActiveRecord::Migration
|
|
|
|
|
|
|
|
def change
|
|
|
|
create_table :tokens do |t|
|
2014-03-14 17:41:49 +00:00
|
|
|
t.integer :subject_id, null: false, references: nil
|
2014-01-21 04:51:49 +00:00
|
|
|
t.string :subject_type, null: false
|
2014-03-14 17:41:49 +00:00
|
|
|
t.integer :creator_id, null: false, references: nil
|
|
|
|
t.integer :updater_id, references: nil
|
2014-01-21 04:51:49 +00:00
|
|
|
t.string :status, default: 'active'
|
2013-06-25 08:00:20 +01:00
|
|
|
t.text :description
|
2014-01-21 04:51:49 +00:00
|
|
|
t.string :authentication_token, null: false
|
2013-06-25 08:00:20 +01:00
|
|
|
|
|
|
|
t.timestamps
|
|
|
|
end
|
2014-01-21 04:51:49 +00:00
|
|
|
add_index :tokens, :authentication_token, unique: true
|
2013-06-25 08:00:20 +01:00
|
|
|
add_index :tokens, [:subject_id, :subject_type]
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|