# frozen_string_literal: true

class CreateVulnerabilityFindingsRemediationsJoinTable < ActiveRecord::Migration[6.0]
  DOWNTIME = false

  def change
    create_table :vulnerability_findings_remediations do |t|
      t.references :vulnerability_occurrence, index: false, foreign_key: { on_delete: :cascade }
      t.references :vulnerability_remediation, index: { name: 'index_vulnerability_findings_remediations_on_remediation_id' }, foreign_key: { on_delete: :cascade }

      t.timestamps_with_timezone

      t.index [:vulnerability_occurrence_id, :vulnerability_remediation_id], unique: true, name: 'index_vulnerability_findings_remediations_on_unique_keys'
    end
  end
end
