Fix rolling updates by moving DropEndToEndMessageTables to post-deployment migrations (#31963)
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class DropEndToEndMessageTables < ActiveRecord::Migration[7.1]
|
||||
def up
|
||||
drop_table :system_keys
|
||||
drop_table :one_time_keys
|
||||
drop_table :encrypted_messages
|
||||
drop_table :devices
|
||||
safety_assured { remove_column :accounts, :devices_url }
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
||||
@@ -1,33 +0,0 @@
|
||||
# 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
|
||||
Reference in New Issue
Block a user