[#633] WikiPages may have no author - but should have
Chili 1.x did not enforce the presence of an author for wiki pages, but Chili 2.x does. This migrations fails, if there are WikiPages or Versions without author. By updating the migration, we may ensure, that the erroneous pages are correctly updated. Signed-off-by: Holger Just <h.just@finn.de>
This commit is contained in:
parent
0d306a8bfc
commit
3fd809f059
|
@ -24,6 +24,11 @@ class MergeWikiVersionsWithJournals < ActiveRecord::Migration
|
|||
end
|
||||
}
|
||||
|
||||
# assign all wiki_contents w/o author to the anonymous user - they used to
|
||||
# work w/o author but don't any more.
|
||||
WikiContent.update_all({:author_id => User.anonymous.id}, :author_id => nil)
|
||||
WikiContent::Version.update_all({:author_id => User.anonymous.id}, :author_id => nil)
|
||||
|
||||
WikiContent::Version.find_by_sql("SELECT * FROM wiki_content_versions").each do |wv|
|
||||
journal = WikiContentJournal.create!(:journaled_id => wv.wiki_content_id, :user_id => wv.author_id,
|
||||
:notes => wv.comments, :created_at => wv.updated_on, :activity_type => "wiki_edits")
|
||||
|
|
Loading…
Reference in New Issue