defmodule Towerops.Repo.Migrations.CreateFirmwareReleases do
  use Ecto.Migration

  def change do
    create table(:firmware_releases, primary_key: false) do
      add :id, :binary_id, primary_key: true

      add :vendor, :string, null: false
      add :product_line, :string
      add :version, :string, null: false
      add :release_date, :date
      add :download_url, :string
      add :changelog_url, :string
      add :metadata, :map, default: %{}, null: false
      add :fetched_at, :utc_datetime, null: false

      timestamps(type: :utc_datetime)
    end

    create unique_index(:firmware_releases, [:vendor, :product_line])
  end
end
