Merge pull request #8721 from mfo/US/fix-active_storage_attachment_missing_fk_on_blob_id

correctif(data): ajoute la clé etrangère entre active_storage_attachements et active_storage_blobs uniquement si elle est manquante
This commit is contained in:
mfo 2023-03-06 14:24:03 +01:00 committed by GitHub
commit 10f350a781
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,7 @@
class FixActiveStorageAttachmentMissingFkOnBlobId < ActiveRecord::Migration[6.1] class FixActiveStorageAttachmentMissingFkOnBlobId < ActiveRecord::Migration[6.1]
def change def change
add_foreign_key :active_storage_attachments, :active_storage_blobs, column: :blob_id, validate: false if !foreign_key_exists?(:active_storage_attachments, :active_storage_blobs, column: :blob_id)
add_foreign_key :active_storage_attachments, :active_storage_blobs, column: :blob_id, validate: false
end
end end
end end