Sha256: a8f4621254c693e44bbe8e777aa51812224b00d8ec1cea80c6aeea8d7c2a9463

Contents?: true

Size: 903 Bytes

Versions: 1

Compression:

Stored size: 903 Bytes

Contents

class CreateCredentials < ActiveRecord::Migration
  def change
    create_table :credentials do |t|
      t.references :user, :null => false
      t.string :type, :limit => 32, :null => false
      t.string :name, :limit => 128, :null => true

      t.timestamp :updated_at, :null => false

      t.binary :key, :limit => 2.kilobytes, :null => true
    end

    # All the credentials (maybe of a specific type) belonging to a user.
    add_index :credentials, [:user_id, :type], :unique => false,
                                               :null => false
    # A specific credential, to find out what user it belongs to.
    add_index :credentials, [:type, :name], :unique => true, :null => true
    # Expired credentials (particularly useful for tokens).
    add_index :credentials, [:type, :updated_at], :unique => false,
                                                  :null => false
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
authpwn_rails-0.13.4 lib/authpwn_rails/generators/templates/003_create_credentials.rb