aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/db/update_migrate/20180723000244_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.rb
blob: 6830203cd6189e66fc94e2f3e2b375cf934dab52 (plain) (blame)
1
2
3
4
5
6
7
class AddForeignKeyConstraintToActiveStorageAttachmentsForBlobId < ActiveRecord::Migration[6.0]
  def up
    unless foreign_key_exists?(:active_storage_attachments, column: :blob_id)
      add_foreign_key :active_storage_attachments, :active_storage_blobs, column: :blob_id
    end
  end
end