From 77665b52523d13532c16c97090b83c7ef88e2b62 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 15 Dec 2013 11:02:24 +0000 Subject: Store relation type instead of i18n key in journals (#15704). git-svn-id: http://svn.redmine.org/redmine/trunk@12416 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- ...04612_store_relation_type_in_journal_details.rb | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 db/migrate/20131215104612_store_relation_type_in_journal_details.rb (limited to 'db/migrate') diff --git a/db/migrate/20131215104612_store_relation_type_in_journal_details.rb b/db/migrate/20131215104612_store_relation_type_in_journal_details.rb new file mode 100644 index 000000000..3fa6b1f11 --- /dev/null +++ b/db/migrate/20131215104612_store_relation_type_in_journal_details.rb @@ -0,0 +1,26 @@ +class StoreRelationTypeInJournalDetails < ActiveRecord::Migration + + MAPPING = { + "label_relates_to" => "relates", + "label_duplicates" => "duplicates", + "label_duplicated_by" => "duplicated", + "label_blocks" => "blocks", + "label_blocked_by" => "blocked", + "label_precedes" => "precedes", + "label_follows" => "follows", + "label_copied_to" => "copied_to", + "label_copied_from" => "copied_from" + } + + def up + StoreRelationTypeInJournalDetails::MAPPING.each do |prop_key, replacement| + JournalDetail.where(:property => 'relation', :prop_key => prop_key).update_all(:prop_key => replacement) + end + end + + def down + StoreRelationTypeInJournalDetails::MAPPING.each do |prop_key, replacement| + JournalDetail.where(:property => 'relation', :prop_key => replacement).update_all(:prop_key => prop_key) + end + end +end -- cgit v1.2.3