Sha256: b2fb6f1ba66907065ef4845913eb7c79bc90644126d91595b4952f3e1c06dbc8

Contents?: true

Size: 879 Bytes

Versions: 53

Compression:

Stored size: 879 Bytes

Contents

# frozen_string_literal: true

class RenameMaximumVotesPerProposalToThresholdPerProposal < ActiveRecord::Migration[5.1]
  def up
    execute <<~SQL.squish
      UPDATE decidim_components
      SET settings = jsonb_set(
        settings::jsonb,
        array['global'],
        (settings->'global')::jsonb - 'maximum_votes_per_proposal' || jsonb_build_object('threshold_per_proposal', settings->'global'->'maximum_votes_per_proposal')
        )
      WHERE manifest_name = 'proposals'
    SQL
  end

  def down
    execute <<~SQL.squish
      UPDATE decidim_components
      SET settings = jsonb_set(
        settings::jsonb,
        array['global'],
        (settings->'global')::jsonb - 'threshold_per_proposal' || jsonb_build_object('maximum_votes_per_proposal', settings->'global'->'threshold_per_proposal')
        )
      WHERE manifest_name = 'proposals'
    SQL
  end
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
decidim-core-0.30.0.rc1 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.29.2 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.28.5 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.29.1 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.28.4 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.27.9 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.29.0 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.28.3 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.27.8 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.29.0.rc4 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.29.0.rc3 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.29.0.rc2 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.29.0.rc1 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.28.2 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.27.7 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.28.1 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.27.6 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.26.10 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.26.9 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.28.0 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb