Sha256: aad38d314af166cecd7f8cca8c35a5433e4d2c240a980f608c6b53d73c18c62f

Contents?: true

Size: 462 Bytes

Versions: 52

Compression:

Stored size: 462 Bytes

Contents

# frozen_string_literal: true

class FixAnsweredProposalsAfterCopy < ActiveRecord::Migration[5.2]
  def change
    proposals_after_copy = Decidim::ResourceLink.where(from_type: "Decidim::Proposals::Proposal").pluck(:from_id)

    result = Decidim::Proposals::Proposal.where.not(state_published_at: nil).where(state: nil, id: proposals_after_copy)

    result.find_each do |proposal|
      proposal.state_published_at = nil
      proposal.save!
    end
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

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