0
0
Fork 0

Fix rolling updates by moving DropEndToEndMessageTables to post-deployment migrations (#31963)

This commit is contained in:
Claire 2024-09-19 11:50:06 +02:00 committed by GitHub
parent 29656cb9e0
commit 62a39d60ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 0 additions and 0 deletions

View file

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

View file

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