Commit 3fd809f0 authored by Gregor Schmidt's avatar Gregor Schmidt Committed by Holger Just

[#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: 's avatarHolger Just <h.just@finn.de>
parent 0d306a8b
......@@ -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")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment