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.29.1 db/migrate/20210127115628_fix_answered_proposals_after_copy.rb
decidim-proposals-0.28.4 db/migrate/20210127115628_fix_answered_proposals_after_copy.rb
decidim-proposals-0.27.9 db/migrate/20210127115628_fix_answered_proposals_after_copy.rb
decidim-proposals-0.29.0 db/migrate/20210127115628_fix_answered_proposals_after_copy.rb
decidim-proposals-0.28.3 db/migrate/20210127115628_fix_answered_proposals_after_copy.rb
decidim-proposals-0.27.8 db/migrate/20210127115628_fix_answered_proposals_after_copy.rb
decidim-proposals-0.29.0.rc4 db/migrate/20210127115628_fix_answered_proposals_after_copy.rb
decidim-proposals-0.29.0.rc3 db/migrate/20210127115628_fix_answered_proposals_after_copy.rb
decidim-proposals-0.29.0.rc2 db/migrate/20210127115628_fix_answered_proposals_after_copy.rb
decidim-proposals-0.29.0.rc1 db/migrate/20210127115628_fix_answered_proposals_after_copy.rb
decidim-proposals-0.28.2 db/migrate/20210127115628_fix_answered_proposals_after_copy.rb
decidim-proposals-0.27.7 db/migrate/20210127115628_fix_answered_proposals_after_copy.rb
decidim-proposals-0.28.1 db/migrate/20210127115628_fix_answered_proposals_after_copy.rb
decidim-proposals-0.27.6 db/migrate/20210127115628_fix_answered_proposals_after_copy.rb
decidim-proposals-0.26.10 db/migrate/20210127115628_fix_answered_proposals_after_copy.rb
decidim-proposals-0.26.9 db/migrate/20210127115628_fix_answered_proposals_after_copy.rb
decidim-proposals-0.28.0 db/migrate/20210127115628_fix_answered_proposals_after_copy.rb
decidim-proposals-0.27.5 db/migrate/20210127115628_fix_answered_proposals_after_copy.rb
decidim-proposals-0.28.0.rc5 db/migrate/20210127115628_fix_answered_proposals_after_copy.rb
decidim-proposals-0.28.0.rc4 db/migrate/20210127115628_fix_answered_proposals_after_copy.rb