# This migration comes from decidim (originally 20170220110740)
class RemoveStepsShortDescription < ActiveRecord::Migration[5.0]
  def change
    Decidim::ParticipatoryProcessStep.transaction do
      Decidim::ParticipatoryProcessStep.find_each do |step|
        step.update_attributes!(
          description: new_description_for(step)
        )
      end

      remove_column :decidim_participatory_process_steps, :short_description
    end
  end

  def new_description_for(step)
    desc = {}
    step.description.keys.each do |locale|
      next unless step.short_description && step.description
      desc[locale] = step.short_description[locale] + step.description[locale]
    end
    desc
  end
end

# This migration comes from decidim (originally 20170220110740)
class RemoveStepsShortDescription < ActiveRecord::Migration[5.0]
  def change
    remove_column :decidim_participatory_process_steps, :short_description
  end
end

Simplify migration as the descriptions used are always `description`
Simplify migration as the descriptions used are always `description`
