FIX: Post migration to fix custom emojis with secure URL

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 08:51:42 +10:00
parent ebb5c1ff4d
commit 21a356e3af
No known key found for this signature in database
GPG Key ID: A08063EEF3EA26A4
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