discourse/db/migrate/20250505050610_optimized_image_format_index.rb
Sam c8d6dd2a92
FIX: key optimized images on format (#32575)
Previous to this change when we used to specify format it could get an
image
in the incorrect format.

Also... allows image magick to decode svg

---

There remains a bug where the crop / resize information is not stored in
optimized images
this means that sometimes when asking for a cropped image you may get a
resized one.
2025-05-06 14:40:51 +10:00

17 lines
624 B
Ruby

# frozen_string_literal: true
class OptimizedImageFormatIndex < ActiveRecord::Migration[7.2]
def up
remove_index :optimized_images, name: "index_optimized_images_on_upload_id_and_width_and_height"
add_index :optimized_images,
%i[upload_id width height extension],
name: "index_optimized_images_unique",
unique: true
end
def down
remove_index :optimized_images, name: "index_optimized_images_unique"
add_index :optimized_images,
%i[upload_id width height],
name: "index_optimized_images_on_upload_id_and_width_and_height"
end
end