20191017122807_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb 487 B

123456789101112
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. # This migration comes from active_storage (originally 20180723000244)
  3. class AddForeignKeyConstraintToActiveStorageAttachmentsForBlobId < ActiveRecord::Migration[6.0]
  4. def up
  5. return if foreign_key_exists?(:active_storage_attachments, column: :blob_id)
  6. return if !table_exists?(:active_storage_blobs)
  7. add_foreign_key :active_storage_attachments, :active_storage_blobs, column: :blob_id
  8. end
  9. end