20120101000080_create_token.rb 458 B

1234567891011121314151617
  1. class CreateToken < ActiveRecord::Migration
  2. def up
  3. create_table :tokens do |t|
  4. t.references :user, :null => false
  5. t.string :name, :limit => 100, :null => false
  6. t.string :action, :limit => 40, :null => false
  7. t.timestamps
  8. end
  9. add_index :tokens, :user_id
  10. add_index :tokens, [:name, :action], :unique => true
  11. add_index :tokens, :created_at
  12. end
  13. def down
  14. drop_table :tokens
  15. end
  16. end