Merge remote-tracking branch 'parent/main' into upstream-20240610

This commit is contained in:
KMY 2024-06-10 08:19:27 +09:00
commit 90f2ea9015
125 changed files with 2266 additions and 1504 deletions

View file

@ -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