mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-20 03:25:17 +01:00
Remove crypto
values from doorkeeper application/token scopes
(#31945)
This commit is contained in:
parent
5405bdd344
commit
6f836c45aa
33
db/migrate/20240916190140_remove_crypto_scope_values.rb
Normal file
33
db/migrate/20240916190140_remove_crypto_scope_values.rb
Normal file
@ -0,0 +1,33 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class RemoveCryptoScopeValues < ActiveRecord::Migration[7.1]
|
||||
def up
|
||||
applications.in_batches do |records|
|
||||
records.update_all(<<~SQL.squish)
|
||||
scopes = TRIM(REPLACE(scopes, 'crypto', ''))
|
||||
SQL
|
||||
end
|
||||
|
||||
tokens.in_batches do |records|
|
||||
records.update_all(<<~SQL.squish)
|
||||
scopes = TRIM(REPLACE(scopes, 'crypto', ''))
|
||||
SQL
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def applications
|
||||
Doorkeeper::Application
|
||||
.where("scopes LIKE '%crypto%'")
|
||||
end
|
||||
|
||||
def tokens
|
||||
Doorkeeper::AccessToken
|
||||
.where("scopes LIKE '%crypto%'")
|
||||
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_09_09_014637) do
|
||||
ActiveRecord::Schema[7.1].define(version: 2024_09_16_190140) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user