From 81c162b65dfb278be75afa22ed2d074b1963544b Mon Sep 17 00:00:00 2001 From: annikoff Date: Mon, 20 Feb 2017 16:22:03 +0300 Subject: [PATCH] fix migration, bump version --- CHANGELOG.md | 6 +++++- db/migrate/20170205204732_convert_custom_fields.rb | 4 ++-- init.rb | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f8cc3c..8d22702 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Change Log -## [1.0.1](https://github.com/annikoff/redmine_plugin_computed_custom_field/releases/tag/v1.0.0) - 2017-02-20 +## [1.0.2](https://github.com/annikoff/redmine_plugin_computed_custom_field/releases/tag/v1.0.2) - 2017-02-20 +### Fixed +- Migration. + +## [1.0.1](https://github.com/annikoff/redmine_plugin_computed_custom_field/releases/tag/v1.0.1) - 2017-02-20 ### Fixed - Migration. diff --git a/db/migrate/20170205204732_convert_custom_fields.rb b/db/migrate/20170205204732_convert_custom_fields.rb index c14e36e..0d906d7 100644 --- a/db/migrate/20170205204732_convert_custom_fields.rb +++ b/db/migrate/20170205204732_convert_custom_fields.rb @@ -2,6 +2,7 @@ class ConvertCustomFields < ActiveRecord::Migration def up fields = CustomField.where(field_format: 'computed') fields.each do |field| + field.update_attribute(:formula, field.format_store[:formula]) format = case field.format_store[:output_format] when 'integer' 'int' @@ -10,9 +11,8 @@ def up else field.format_store[:output_format] end - formula = field.format_store[:formula] sql = "UPDATE #{CustomField.table_name} SET " - sql << "is_computed = '1', field_format = '#{format}', formula = '#{formula}' WHERE id = #{field.id}" + sql << "is_computed = '1', field_format = '#{format}' WHERE id = #{field.id}" ActiveRecord::Base.connection.execute(sql) end end diff --git a/init.rb b/init.rb index a34b8c7..4a6f37d 100644 --- a/init.rb +++ b/init.rb @@ -3,7 +3,7 @@ author 'Yakov Annikov' url 'https://github.com/annikoff/redmine_plugin_computed_custom_field' description '' - version '1.0.1' + version '1.0.2' settings default: {} end