Sha256: 684823ab2db5b0fad21b9b812378a923296b473482eacc1e221a895670745cfc

Contents?: true

Size: 479 Bytes

Versions: 10

Compression:

Stored size: 479 Bytes

Contents

# frozen_string_literal: true

class AddAnswerOptionsCounterCacheToQuestions < ActiveRecord::Migration[6.1]
  def change
    add_column :decidim_forms_questions, :answer_options_count, :integer, null: false, default: 0

    reversible do |dir|
      dir.up do
        Decidim::Forms::Question.reset_column_information
        Decidim::Forms::Question.find_each do |record|
          record.class.reset_counters(record.id, :answer_options)
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
decidim-forms-0.30.0.rc3 db/migrate/20240402092039_add_answer_options_counter_cache_to_questions.rb
decidim-forms-0.30.0.rc2 db/migrate/20240402092039_add_answer_options_counter_cache_to_questions.rb
decidim-forms-0.30.0.rc1 db/migrate/20240402092039_add_answer_options_counter_cache_to_questions.rb
decidim-forms-0.29.2 db/migrate/20240402092039_add_answer_options_counter_cache_to_questions.rb
decidim-forms-0.29.1 db/migrate/20240402092039_add_answer_options_counter_cache_to_questions.rb
decidim-forms-0.29.0 db/migrate/20240402092039_add_answer_options_counter_cache_to_questions.rb
decidim-forms-0.29.0.rc4 db/migrate/20240402092039_add_answer_options_counter_cache_to_questions.rb
decidim-forms-0.29.0.rc3 db/migrate/20240402092039_add_answer_options_counter_cache_to_questions.rb
decidim-forms-0.29.0.rc2 db/migrate/20240402092039_add_answer_options_counter_cache_to_questions.rb
decidim-forms-0.29.0.rc1 db/migrate/20240402092039_add_answer_options_counter_cache_to_questions.rb