Skip to content

Commit

Permalink
feat: add replace to null decidim_proposals command
Browse files Browse the repository at this point in the history
  • Loading branch information
ayuki-joto committed Sep 29, 2022
1 parent fe9f923 commit 0037abe
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/tasks/replace_to_null.rake
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,16 @@ namespace :replace_to_null do
end
end
end

desc 'fix proposal edit bug.Make all "" columns of decidim_proposals_proposals table null'
task decidim_proposals: :environment do
Decidim::Proposals::Proposal.transaction do
Decidim::Proposals::Proposal.all.each do |proposal|
proposal.answer = nil if proposal.answer == ""
proposal.cost_report = nil if proposal.cost_report == ""
proposal.execution_period = nil if proposal.execution_period == ""
proposal.save!
end
end
end
end

0 comments on commit 0037abe

Please sign in to comment.