Sha256: 0129e35b9a707437c41ede4694dc9e50834b38e948f8ccd7e0666f5cc6c8a23d

Contents?: true

Size: 728 Bytes

Versions: 3

Compression:

Stored size: 728 Bytes

Contents

class CreateCredentials < ActiveRecord::Migration[5.0]
  def change
    create_table :credentials do |t|
      t.references :user, null: false, index: false, foreign_key: true
      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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
authpwn_rails-0.23.0 lib/authpwn_rails/generators/templates/003_create_credentials.rb
authpwn_rails-0.22.1 lib/authpwn_rails/generators/templates/003_create_credentials.rb
authpwn_rails-0.22.0 lib/authpwn_rails/generators/templates/003_create_credentials.rb