Sha256: 8d6c2157b649d0cb1d83ff86b6bddd6d0351b8ea6be8b76ebdd284c4f0884f57

Contents?: true

Size: 865 Bytes

Versions: 38

Compression:

Stored size: 865 Bytes

Contents

# frozen_string_literal: true

class RenameMaximumVotesPerProposalToThresholdPerProposal < ActiveRecord::Migration[5.1]
  def up
    execute <<~SQL
      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
      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

38 entries across 38 versions & 1 rubygems

Version Path
decidim-core-0.23.6 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.23.5 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.23.4 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.23.3 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.23.2 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.23.1 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.23.1.rc1 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.23.0 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.22.0 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.21.0 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.20.1 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.20.0 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.19.1 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.18.1 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.19.0 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.17.2 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.18.0 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.17.1 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.16.1 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb
decidim-core-0.17.0 db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb