Change read:me scope to profile scope (#30357)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ChangeReadMeScopeToProfile < ActiveRecord::Migration[7.1]
|
||||
def up
|
||||
replace_scopes('read:me', 'profile')
|
||||
end
|
||||
|
||||
def down
|
||||
replace_scopes('profile', 'read:me')
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def replace_scopes(old_scope, new_scope)
|
||||
Doorkeeper::Application.where("scopes LIKE '%#{old_scope}%'").in_batches do |applications|
|
||||
applications.update_all("scopes = replace(scopes, '#{old_scope}', '#{new_scope}')")
|
||||
end
|
||||
|
||||
Doorkeeper::AccessToken.where("scopes LIKE '%#{old_scope}%'").in_batches do |access_tokens|
|
||||
access_tokens.update_all("scopes = replace(scopes, '#{old_scope}', '#{new_scope}')")
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.1].define(version: 2024_05_22_041528) do
|
||||
ActiveRecord::Schema[7.1].define(version: 2024_06_03_195202) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user