OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/db/migrate/20120319135006_add_custom_f...

25 lines
561 B

class AddCustomFieldTranslationTable < ActiveRecord::Migration
def self.up
CustomField.create_translation_table! :name => :string
I18n.locale = Setting.default_language.to_sym
CustomField.all.each do |f|
f.name = f.read_attribute(:name)
f.save
end
remove_column :custom_fields, :name
end
def self.down
add_column :custom_fields, :name
I18n.locale = Setting.default_language.to_sym
CustomField.all.each do |f|
f.write_attribute(:name, f.name)
end
CustomField.drop_translation_table!
end
end