Sha256: 73069c897076f2ec4d32dfb0812c8d3c6006f219527d682a67275668f56124af
Contents?: true
Size: 1.13 KB
Versions: 5
Compression:
Stored size: 1.13 KB
Contents
# frozen_string_literal: true namespace :decidim_proposals do namespace :upgrade do desc "Removes all proposal valuator records of which the role assignment does not exists" task remove_valuator_orphan_records: :environment do if Decidim.module_installed?("participatory_processes") Decidim::Proposals::ValuationAssignment .where(valuator_role_type: "Decidim::ParticipatoryProcessUserRole") .where .not(valuator_role_id: Decidim::ParticipatoryProcessUserRole.pluck(:id)) .destroy_all end if Decidim.module_installed?("assemblies") Decidim::Proposals::ValuationAssignment .where(valuator_role_type: "Decidim::AssemblyUserRole") .where .not(valuator_role_id: Decidim::AssemblyUserRole.pluck(:id)) .destroy_all end if Decidim.module_installed?("conferences") Decidim::Proposals::ValuationAssignment .where(valuator_role_type: "Decidim::ConferenceUserRole") .where .not(valuator_role_id: Decidim::ConferenceUserRole.pluck(:id)) .destroy_all end end end end
Version data entries
5 entries across 5 versions & 1 rubygems