Class: SongkickOauth2SchemaAddAuthorizationIndex

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/songkick/oauth2/schema/20121024180930_songkick_oauth2_schema_add_authorization_index.rb

Constant Summary collapse

INDEX_NAME =
'index_owner_client_pairs'

Class Method Summary collapse

Class Method Details

.downObject



9
10
11
12
# File 'lib/songkick/oauth2/schema/20121024180930_songkick_oauth2_schema_add_authorization_index.rb', line 9

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

.upObject



4
5
6
7
# File 'lib/songkick/oauth2/schema/20121024180930_songkick_oauth2_schema_add_authorization_index.rb', line 4

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