defmodule Mv.Repo.Migrations.AddMembershipFeeSettings do
  @moduledoc """
  Adds membership fee settings to the settings table.

  Note: The members table columns (membership_fee_start_date, membership_fee_type_id)
  were already added in migration 20251211151449_add_membership_fees_tables.
  """

  use Ecto.Migration

  def up do
    # Add membership fee settings to the settings table
    alter table(:settings) do
      add_if_not_exists :include_joining_cycle, :boolean, null: false, default: true
      add_if_not_exists :default_membership_fee_type_id, :uuid
    end
  end

  def down do
    alter table(:settings) do
      remove_if_exists :default_membership_fee_type_id, :uuid
      remove_if_exists :include_joining_cycle, :boolean
    end
  end
end
