defmodule Mv.Repo.Migrations.AddJoinFormSettingsToSettings do
  @moduledoc """
  Adds join form configuration columns to the settings table.

  - join_form_enabled: whether the public /join page is active
  - join_form_field_ids: ordered list of field IDs shown on the join form (JSONB array)
  - join_form_field_required: map of field ID => required boolean (JSONB)
  """

  use Ecto.Migration

  def up do
    alter table(:settings) do
      add :join_form_enabled, :boolean, default: false, null: false
      add :join_form_field_ids, {:array, :string}
      add :join_form_field_required, :map
    end
  end

  def down do
    alter table(:settings) do
      remove :join_form_enabled
      remove :join_form_field_ids
      remove :join_form_field_required
    end
  end
end
