Avoid touching journaled objects on backdated journal creation.

This commit is contained in:
Felix Schäfer 2011-07-29 18:21:04 +02:00
parent 5015ca4878
commit 4bc5bc9fa6
2 changed files with 12 additions and 0 deletions

View File

@ -28,6 +28,12 @@ class BuildInitialJournalsForActsAsJournalized < ActiveRecord::Migration
[Message, Attachment, Document, Changeset, Issue, TimeEntry, News].each do |p|
say_with_time("Building initial journals for #{p.class_name}") do
# avoid touching the journaled object on journal creation
p.journal_class.class_exec {
def touch_journaled_after_creation
end
}
activity_type = p.activity_provider_options.keys.first
# Create initial journals

View File

@ -18,6 +18,12 @@ class MergeWikiVersionsWithJournals < ActiveRecord::Migration
WikiContent.const_set("Version", Class.new(ActiveRecord::Base))
end
# avoid touching WikiContent on journal creation
WikiContentJournal.class_exec {
def touch_journaled_after_creation
end
}
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")