Class: SongkickOauth2SchemaOriginalSchema

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

Class Method Summary collapse

Class Method Details

.downObject


31
32
33
34
# File 'lib/songkick/oauth2/schema/20120828112156_songkick_oauth2_schema_original_schema.rb', line 31

def self.down
  drop_table :oauth2_clients
  drop_table :oauth2_authorizations
end

.upObject


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/songkick/oauth2/schema/20120828112156_songkick_oauth2_schema_original_schema.rb', line 2

def self.up
  create_table :oauth2_clients do |t|
    t.timestamps
    t.string     :oauth2_client_owner_type
    t.integer    :oauth2_client_owner_id
    t.string     :name
    t.string     :client_id
    t.string     :client_secret_hash
    t.string     :redirect_uri
  end
  add_index :oauth2_clients, [:client_id]

  create_table :oauth2_authorizations do |t|
    t.timestamps
    t.string     :oauth2_resource_owner_type
    t.integer    :oauth2_resource_owner_id
    t.belongs_to :client
    t.string     :scope
    t.string     :code,               :limit => 40
    t.string     :access_token_hash,  :limit => 40
    t.string     :refresh_token_hash, :limit => 40
    t.datetime   :expires_at
  end
  add_index :oauth2_authorizations, [:client_id, :code]
  add_index :oauth2_authorizations, [:access_token_hash]
  add_index :oauth2_authorizations, [:client_id, :access_token_hash]
  add_index :oauth2_authorizations, [:client_id, :refresh_token_hash]
end