songkick/oauth2-provider

View on GitHub
lib/songkick/oauth2/schema/20121024180930_songkick_oauth2_schema_add_authorization_index.rb

Summary

Maintainability
A
0 mins
Test Coverage
class SongkickOauth2SchemaAddAuthorizationIndex < ActiveRecord::Migration[6.1]
  INDEX_NAME = 'index_owner_client_pairs'

  def self.up
    remove_index :oauth2_authorizations, [:client_id, :access_token_hash]
    add_index :oauth2_authorizations, [:client_id, :oauth2_resource_owner_type, :oauth2_resource_owner_id], :name => INDEX_NAME, :unique => true
  end

  def self.down
    remove_index :oauth2_authorizations, :name => INDEX_NAME
    add_index :oauth2_authorizations, [:client_id, :access_token_hash]
  end
end