defmodule Berrypod.Repo.Migrations.CreateDeadLinks do
  use Ecto.Migration

  def change do
    create table(:dead_links, primary_key: false) do
      add :id, :binary_id, primary_key: true
      add :url, :string, null: false
      add :url_type, :string, null: false, default: "external"
      add :status, :string, null: false, default: "broken"
      add :http_status, :integer
      add :error, :string
      add :last_checked_at, :utc_datetime, null: false

      timestamps()
    end

    create unique_index(:dead_links, [:url])
    create index(:dead_links, [:status])
  end
end
