814 B · text History b868907
defmodule GitGud.Repo.Migrations.AddRepositoryLicense do
  use Ecto.Migration

  @moduledoc """
  The licence a repository is under, detected from the file it keeps it
  in and refreshed when a new HEAD lands.

  Derived state, like the language tag: the git repository is the
  source of truth and this is a cache of what the last look found, so
  nothing casts it from user input and a wrong value is fixed by
  pushing or by re-running detection.

  `license_file` records which file the answer came from, so "why does
  it say Apache-2.0" has an answer that doesn't require guessing —
  a repository can carry several, and the one that was read is the one
  that matters.
  """

  def change do
    alter table(:repositories) do
      add :license, :string
      add :license_file, :string
    end
  end
end