Sha256: 1d668fe49e886f21995d6d5dea1c7639ebda49bba274561485d3fc4934962ecf

Contents?: true

Size: 702 Bytes

Versions: 50

Compression:

Stored size: 702 Bytes

Contents

# frozen_string_literal: true

class RemoveStepsShortDescription < ActiveRecord::Migration[5.0]
  class ParticipatoryProcessStep < ApplicationRecord
    self.table_name = :decidim_participatory_process_steps
  end

  def change
    ParticipatoryProcessStep.transaction do
      ParticipatoryProcessStep.find_each do |step|
        step.update!(
          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|
      desc[locale] = step.short_description[locale] + step.description[locale]
    end
    desc
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
decidim-participatory_processes-0.26.8 db/migrate/20170220110740_remove_steps_short_description.rb
decidim-participatory_processes-0.27.4 db/migrate/20170220110740_remove_steps_short_description.rb
decidim-participatory_processes-0.27.3 db/migrate/20170220110740_remove_steps_short_description.rb
decidim-participatory_processes-0.26.7 db/migrate/20170220110740_remove_steps_short_description.rb
decidim-participatory_processes-0.26.5 db/migrate/20170220110740_remove_steps_short_description.rb
decidim-participatory_processes-0.27.2 db/migrate/20170220110740_remove_steps_short_description.rb
decidim-participatory_processes-0.27.1 db/migrate/20170220110740_remove_steps_short_description.rb
decidim-participatory_processes-0.26.4 db/migrate/20170220110740_remove_steps_short_description.rb
decidim-participatory_processes-0.27.0 db/migrate/20170220110740_remove_steps_short_description.rb
decidim-participatory_processes-0.26.3 db/migrate/20170220110740_remove_steps_short_description.rb
decidim-participatory_processes-0.27.0.rc2 db/migrate/20170220110740_remove_steps_short_description.rb
decidim-participatory_processes-0.27.0.rc1 db/migrate/20170220110740_remove_steps_short_description.rb
decidim-participatory_processes-0.26.2 db/migrate/20170220110740_remove_steps_short_description.rb
decidim-participatory_processes-0.26.1 db/migrate/20170220110740_remove_steps_short_description.rb
decidim-participatory_processes-0.26.0 db/migrate/20170220110740_remove_steps_short_description.rb
decidim-participatory_processes-0.26.0.rc2 db/migrate/20170220110740_remove_steps_short_description.rb
decidim-participatory_processes-0.26.0.rc1 db/migrate/20170220110740_remove_steps_short_description.rb
decidim-participatory_processes-0.25.2 db/migrate/20170220110740_remove_steps_short_description.rb
decidim-participatory_processes-0.25.1 db/migrate/20170220110740_remove_steps_short_description.rb
decidim-participatory_processes-0.25.0 db/migrate/20170220110740_remove_steps_short_description.rb