forked from decidim/decidim
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to update existing data => moderation
- Loading branch information
1 parent
3cda971
commit f6a7ca0
Showing
1 changed file
with
11 additions
and
0 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
decidim-comments/db/migrate/20180201195211_add_data_for_moderation.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class AddDataForModeration < ActiveRecord::Migration[5.1] | ||
def up | ||
Decidim::Comments::Comment.all.each {|c|Decidim::Moderation.find_or_create_by!(reportable: c, participatory_space: c.feature.participatory_space, upstream_moderation: "authorized")} | ||
|
||
Decidim::Proposals::Proposal.all.each {|p|Decidim::Moderation.find_or_create_by!(reportable: p, participatory_space: p.feature.participatory_space, upstream_moderation: "authorized")} | ||
|
||
Decidim::Moderation.all.each {|m| m.update_attributes(upstream_moderation: "authorized")} | ||
end | ||
|
||
def down; end | ||
end |