Skip to content

Commit

Permalink
Ensure scope column of oauth_access_grants is not null
Browse files Browse the repository at this point in the history
As of Doorkeeper 5.2.0.rc3, an authorization request must
include a 'scope' param in case the server does not define a
default scope, in line with https://tools.ietf.org/html/rfc6749#section-3.3.

https://github.com/doorkeeper-gem/doorkeeper/wiki/Migration-from-old-versions#from-51x-to-52x
  • Loading branch information
edwardkerry committed Mar 2, 2020
1 parent 73845cf commit 411dae1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class ChangeScopeToNotBeNullOnOauthAccessGrants < ActiveRecord::Migration[5.2]
def up
change_column_default :oauth_access_grants, :scopes, from: nil, to: ''
change_column_null :oauth_access_grants, :scopes, false
end

def down
change_column_default :oauth_access_grants, :scopes, from: '', to: nil
change_column_null :oauth_access_grants, :scopes, true
end
end


4 changes: 2 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2019_09_03_120837) do
ActiveRecord::Schema.define(version: 2020_02_20_161244) do

create_table "batch_invitation_application_permissions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.integer "batch_invitation_id", null: false
Expand Down Expand Up @@ -94,7 +94,7 @@
t.string "redirect_uri", null: false
t.datetime "created_at", null: false
t.datetime "revoked_at"
t.string "scopes"
t.string "scopes", default: "", null: false
t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true
end

Expand Down

0 comments on commit 411dae1

Please sign in to comment.