Fix rolling updates by moving DropEndToEndMessageTables to post-deployment migrations (#31963)
This commit is contained in:
parent
29656cb9e0
commit
62a39d60ce
2 changed files with 0 additions and 0 deletions
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue