class AddGuardianFirstAndLastNameToReleases < ActiveRecord::Migration[6.0]
  RELEASES = [:appearance_releases, :talent_releases]

  def up
    RELEASES.each do |table_name|
      add_column(table_name, :guardian_first_name, :string)
      add_column(table_name, :guardian_last_name, :string)

      rename_column(table_name, :guardian_name, :guardian_name_old)
    end
  end

  def down
    RELEASES.each do |table_name|
      remove_column(table_name, :guardian_first_name, :string)
      remove_column(table_name, :guardian_last_name, :string)
      
      rename_column(table_name, :guardian_name_old, :guardian_name)
    end
  end
end
