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:
commit
10f350a781
1 changed files with 3 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue