anjlab-devise-oauth2-providable 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,47 +9,31 @@ class CreateDeviseOauth2ProvidableSchema < ActiveRecord::Migration
9
9
  t.string :secret
10
10
  t.timestamps
11
11
  end
12
- change_table :oauth2_clients do |t|
13
- t.index :identifier, :unique => true
14
- end
15
12
 
16
- create_table :oauth2_access_tokens do |t|
17
- t.belongs_to :user, :client, :refresh_token
18
- t.string :token
19
- t.datetime :expires_at
20
- t.timestamps
21
- end
22
- change_table :oauth2_access_tokens do |t|
23
- t.index :token, :unique => true
24
- t.index :expires_at
25
- t.index :user_id
26
- t.index :client_id
27
- end
13
+ add_index :oauth2_clients, :identifier, unique: true
14
+ add_index :oauth2_clients, :user_id
28
15
 
29
- create_table :oauth2_refresh_tokens do |t|
30
- t.belongs_to :user, :client
31
- t.string :token
32
- t.datetime :expires_at
33
- t.timestamps
34
- end
35
- change_table :oauth2_refresh_tokens do |t|
36
- t.index :token, :unique => true
37
- t.index :expires_at
38
- t.index :user_id
39
- t.index :client_id
40
- end
16
+ token_tables = %W{
17
+ oauth2_access_tokens
18
+ oauth2_refresh_tokens
19
+ oauth2_authorization_codes
20
+ }.map &:to_sym
41
21
 
42
- create_table :oauth2_authorization_codes do |t|
43
- t.belongs_to :user, :client
44
- t.string :token
45
- t.datetime :expires_at
46
- t.timestamps
47
- end
48
- change_table :oauth2_authorization_codes do |t|
49
- t.index :token, :unique => true
50
- t.index :expires_at
51
- t.index :user_id
52
- t.index :client_id
22
+ token_tables.each do |table_name|
23
+ create_table table_name do |t|
24
+ t.belongs_to :user, :client
25
+ t.belongs_to :refresh_token if table_name == :oauth2_access_tokens
26
+ t.string :token
27
+ t.datetime :expires_at
28
+ t.timestamps
29
+ end
30
+
31
+ add_index table_name, :token, unique: true
32
+ add_index table_name, :expires_at
33
+ add_index table_name, :user_id
34
+ add_index table_name, :client_id
35
+
36
+ add_index table_name, :refresh_token_id if table_name == :oauth2_access_tokens
53
37
  end
54
38
  end
55
- end
39
+ end
@@ -1,5 +1,5 @@
1
1
  module Devise
2
2
  module Oauth2Providable
3
- VERSION = "1.1.0"
3
+ VERSION = "1.1.1"
4
4
  end
5
5
  end
@@ -0,0 +1,40 @@
1
+ # This migration comes from devise_oauth2_providable (originally 20111014160714)
2
+ class CreateDeviseOauth2ProvidableSchema < ActiveRecord::Migration
3
+ def change
4
+ create_table :oauth2_clients do |t|
5
+ t.belongs_to :user
6
+ t.string :name
7
+ t.string :redirect_uri
8
+ t.string :website
9
+ t.string :identifier
10
+ t.string :secret
11
+ t.timestamps
12
+ end
13
+
14
+ add_index :oauth2_clients, :identifier, unique: true
15
+ add_index :oauth2_clients, :user_id
16
+
17
+ token_tables = %W{
18
+ oauth2_access_tokens
19
+ oauth2_refresh_tokens
20
+ oauth2_authorization_codes
21
+ }.map &:to_sym
22
+
23
+ token_tables.each do |table_name|
24
+ create_table table_name do |t|
25
+ t.belongs_to :user, :client
26
+ t.belongs_to :refresh_token if table_name == :oauth2_access_tokens
27
+ t.string :token
28
+ t.datetime :expires_at
29
+ t.timestamps
30
+ end
31
+
32
+ add_index table_name, :token, unique: true
33
+ add_index table_name, :expires_at
34
+ add_index table_name, :user_id
35
+ add_index table_name, :client_id
36
+
37
+ add_index table_name, :refresh_token_id if table_name == :oauth2_access_tokens
38
+ end
39
+ end
40
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anjlab-devise-oauth2-providable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -229,7 +229,7 @@ files:
229
229
  - spec/dummy/config/routes.rb
230
230
  - spec/dummy/db/migrate/20120521101005_create_users.rb
231
231
  - spec/dummy/db/migrate/20120521101006_add_devise_to_users.rb
232
- - spec/dummy/db/migrate/20120521101407_create_devise_oauth2_providable_schema.devise_oauth2_providable.rb
232
+ - spec/dummy/db/migrate/20120522162546_create_devise_oauth2_providable_schema.devise_oauth2_providable.rb
233
233
  - spec/dummy/db/schema.rb
234
234
  - spec/dummy/lib/assets/.gitkeep
235
235
  - spec/dummy/log/.gitkeep
@@ -309,7 +309,7 @@ test_files:
309
309
  - spec/dummy/config/routes.rb
310
310
  - spec/dummy/db/migrate/20120521101005_create_users.rb
311
311
  - spec/dummy/db/migrate/20120521101006_add_devise_to_users.rb
312
- - spec/dummy/db/migrate/20120521101407_create_devise_oauth2_providable_schema.devise_oauth2_providable.rb
312
+ - spec/dummy/db/migrate/20120522162546_create_devise_oauth2_providable_schema.devise_oauth2_providable.rb
313
313
  - spec/dummy/db/schema.rb
314
314
  - spec/dummy/lib/assets/.gitkeep
315
315
  - spec/dummy/log/.gitkeep
@@ -1,56 +0,0 @@
1
- # This migration comes from devise_oauth2_providable (originally 20111014160714)
2
- class CreateDeviseOauth2ProvidableSchema < ActiveRecord::Migration
3
- def change
4
- create_table :oauth2_clients do |t|
5
- t.belongs_to :user
6
- t.string :name
7
- t.string :redirect_uri
8
- t.string :website
9
- t.string :identifier
10
- t.string :secret
11
- t.timestamps
12
- end
13
- change_table :oauth2_clients do |t|
14
- t.index :identifier, :unique => true
15
- end
16
-
17
- create_table :oauth2_access_tokens do |t|
18
- t.belongs_to :user, :client, :refresh_token
19
- t.string :token
20
- t.datetime :expires_at
21
- t.timestamps
22
- end
23
- change_table :oauth2_access_tokens do |t|
24
- t.index :token, :unique => true
25
- t.index :expires_at
26
- t.index :user_id
27
- t.index :client_id
28
- end
29
-
30
- create_table :oauth2_refresh_tokens do |t|
31
- t.belongs_to :user, :client
32
- t.string :token
33
- t.datetime :expires_at
34
- t.timestamps
35
- end
36
- change_table :oauth2_refresh_tokens do |t|
37
- t.index :token, :unique => true
38
- t.index :expires_at
39
- t.index :user_id
40
- t.index :client_id
41
- end
42
-
43
- create_table :oauth2_authorization_codes do |t|
44
- t.belongs_to :user, :client
45
- t.string :token
46
- t.datetime :expires_at
47
- t.timestamps
48
- end
49
- change_table :oauth2_authorization_codes do |t|
50
- t.index :token, :unique => true
51
- t.index :expires_at
52
- t.index :user_id
53
- t.index :client_id
54
- end
55
- end
56
- end