Skip to content

Commit

Permalink
Fix migration
Browse files Browse the repository at this point in the history
  • Loading branch information
felipeelias committed Apr 6, 2019
1 parent 8a75272 commit 8826394
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions db/migrate/20190324080634_create_doorkeeper_tables.rb
Expand Up @@ -18,7 +18,7 @@ def change

create_table :oauth_access_grants do |t|
t.references :resource_owner, null: false
t.references :application, null: false, foreign_key: true
t.references :application, null: false
t.string :token, null: false
t.integer :expires_in, null: false
t.text :redirect_uri, null: false
Expand All @@ -28,10 +28,15 @@ def change
end

add_index :oauth_access_grants, :token, unique: true
add_foreign_key(
:oauth_access_grants,
:oauth_applications,
column: :application_id
)

create_table :oauth_access_tokens do |t|
t.references :resource_owner, index: true
t.references :application, null: false, foreign_key: true
t.references :application, null: false

# If you use a custom token generator you may need to change this column
# from string to text, so that it accepts tokens larger than 255
Expand All @@ -58,6 +63,11 @@ def change

add_index :oauth_access_tokens, :token, unique: true
add_index :oauth_access_tokens, :refresh_token, unique: true
add_foreign_key(
:oauth_access_tokens,
:oauth_applications,
column: :application_id
)

# Uncomment below to ensure a valid reference to the resource owner's table
add_foreign_key :oauth_access_grants, :users, column: :resource_owner_id
Expand Down

0 comments on commit 8826394

Please sign in to comment.