FIX: Post migration to fix custom emojis with secure URL (#15944)

Follow up to 88a8584348. Sets
the baked version of all posts with custom emoji and a secure
media URL in the cooked content to 0. Then our periodic rebake
posts job will rebake them to apply the fix in the linked
commit. This only matters on sites with secure media enabled.
This commit is contained in:
Martin Brennan 2022-02-15 10:37:16 +10:00 committed by GitHub
parent 16b1fcd95e
commit ad9e791ba7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,16 @@
# frozen_string_literal: true
class ResetCustomEmojiPostBakesVersionSecureFix < ActiveRecord::Migration[6.1]
def up
if SiteSetting.secure_media
execute <<~SQL
UPDATE posts SET baked_version = 0
WHERE cooked LIKE '%emoji emoji-custom%' AND cooked LIKE '%secure-media-uploads%'
SQL
end
end
def down
raise ActiveRecord::IrreversibleMigration
end
end