1.1 KiB · text History b868907
defmodule GitGud.Repo.Migrations.AddPublicPackageFormats do
  use Ecto.Migration

  @moduledoc """
  Per-format publishing for repositories that are not themselves public.

  A private or internal repository's packages follow its visibility, so
  an anonymous client — an F-Droid phone, an `apt` host, a `pip` in
  someone else's CI — gets nothing from it and it is absent from the
  namespace-wide `_all` index. That is right for source, and wrong for
  the case where the build artifact is meant to be public and the code
  is not.

  This names the formats that are published anyway. Empty means "follow
  visibility", which is what every existing repository gets, so the
  default is the behaviour that was there before.

  Per format rather than a single boolean because the answer differs by
  format: an Android client belongs on a phone, while the `raw` bucket
  next to it may hold exactly the thing that should stay behind the
  login.
  """

  def change do
    alter table(:repositories) do
      add :public_package_formats, {:array, :string}, null: false, default: []
    end
  end
end