# frozen_string_literal: true

class CreateVulnerabilityIdentifiers < ActiveRecord::Migration[4.2]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  def change
    create_table :vulnerability_identifiers, id: :bigserial do |t|
      t.timestamps_with_timezone null: false

      t.references :project, null: false, foreign_key: { on_delete: :cascade }

      t.binary :fingerprint, null: false, limit: 20
      t.string :external_type, null: false
      t.string :external_id, null: false
      t.string :name, null: false
      t.text :url, null: true

      t.index [:project_id, :fingerprint], unique: true
    end
  end
end
