|
|
|
@ -1,43 +1,43 @@
|
|
|
|
|
class CreateOauths < ActiveRecord::Migration
|
|
|
|
|
def change
|
|
|
|
|
|
|
|
|
|
# create_table :oauths do |t|
|
|
|
|
|
# t.string :client_id
|
|
|
|
|
# t.string :client_secret
|
|
|
|
|
# t.string :code
|
|
|
|
|
# t.string :redirect_uri
|
|
|
|
|
# t.string :scope
|
|
|
|
|
#
|
|
|
|
|
# t.string :access_token
|
|
|
|
|
# t.string :refresh_token
|
|
|
|
|
# t.integer :token_created_at
|
|
|
|
|
# t.integer :token_expires_in #过期时间
|
|
|
|
|
#
|
|
|
|
|
# t.timestamps
|
|
|
|
|
# end
|
|
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
# add_column :oauths, :user_id, :integer, default: 0
|
|
|
|
|
#
|
|
|
|
|
# add_index :oauths, :user_id
|
|
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
# create_table :oauth_configs do |t|
|
|
|
|
|
# t.string :client_id
|
|
|
|
|
# t.string :client_secret
|
|
|
|
|
# t.string :redirect_uri
|
|
|
|
|
# t.string :scope
|
|
|
|
|
#
|
|
|
|
|
# t.timestamps
|
|
|
|
|
# end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# OauthConfig.create(
|
|
|
|
|
# client_id: '88d893c5a345313e7b8c6fcf23d3d024ee08d5e41ce120c3448b6eea77d8de30',
|
|
|
|
|
# client_secret: 'e9240cc5fc913741db5aea93f2986a8ea0631bb67f7c00e41e491b95d9619e64',
|
|
|
|
|
# redirect_uri: 'http://localhost:3000/oschina/login_cb',
|
|
|
|
|
# scope: ''
|
|
|
|
|
# )
|
|
|
|
|
create_table :oauths do |t|
|
|
|
|
|
t.string :client_id
|
|
|
|
|
t.string :client_secret
|
|
|
|
|
t.string :code
|
|
|
|
|
t.string :redirect_uri
|
|
|
|
|
t.string :scope
|
|
|
|
|
|
|
|
|
|
t.string :access_token
|
|
|
|
|
t.string :refresh_token
|
|
|
|
|
t.integer :token_created_at
|
|
|
|
|
t.integer :token_expires_in #过期时间
|
|
|
|
|
|
|
|
|
|
t.timestamps
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
add_column :oauths, :user_id, :integer, default: 0
|
|
|
|
|
|
|
|
|
|
add_index :oauths, :user_id
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
create_table :oauth_configs do |t|
|
|
|
|
|
t.string :client_id
|
|
|
|
|
t.string :client_secret
|
|
|
|
|
t.string :redirect_uri
|
|
|
|
|
t.string :scope
|
|
|
|
|
|
|
|
|
|
t.timestamps
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OauthConfig.create(
|
|
|
|
|
client_id: '88d893c5a345313e7b8c6fcf23d3d024ee08d5e41ce120c3448b6eea77d8de30',
|
|
|
|
|
client_secret: 'e9240cc5fc913741db5aea93f2986a8ea0631bb67f7c00e41e491b95d9619e64',
|
|
|
|
|
redirect_uri: 'http://localhost:3000/oschina/login_cb',
|
|
|
|
|
scope: ''
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|