742 B · text History e569b6d
defmodule CartosnapApp.Repo.Migrations.AddPublicToTrips do
  @moduledoc """
  A public trip is open to anyone who comes across it: listed on the front
  page and viewable at `/t/<id>`. That's separate from sharing by link
  (`share_token`), which is for the people the link is sent to; a trip can
  be either, both, or neither. `public_promoted_only` limits what the
  public sees to the trip's promoted photos, as `share_promoted_only` does
  for the link.
  """

  use Ecto.Migration

  def change do
    alter table(:photo_trips) do
      add :public, :boolean, default: false, null: false
      add :public_promoted_only, :boolean, default: false, null: false
    end

    create index(:photo_trips, [:public], where: "public")
  end
end