diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-12-14 10:01:45 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-12-14 10:01:45 +0000 |
commit | e715c4b847a8c9557dce49400e0dd309e19f7e82 (patch) | |
tree | b480c661b876bdaaeacca9741e0b9876b33c9fec /db/migrate | |
parent | 3e5f1e326aef37943268410994aeaf2481d5db75 (diff) | |
download | redmine-e715c4b847a8c9557dce49400e0dd309e19f7e82.tar.gz redmine-e715c4b847a8c9557dce49400e0dd309e19f7e82.zip |
Removed default values on custom field min and max length.
git-svn-id: http://svn.redmine.org/redmine/trunk@12405 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20131214094309_remove_custom_fields_min_max_length_default_values.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/db/migrate/20131214094309_remove_custom_fields_min_max_length_default_values.rb b/db/migrate/20131214094309_remove_custom_fields_min_max_length_default_values.rb new file mode 100644 index 000000000..d7111c12d --- /dev/null +++ b/db/migrate/20131214094309_remove_custom_fields_min_max_length_default_values.rb @@ -0,0 +1,15 @@ +class RemoveCustomFieldsMinMaxLengthDefaultValues < ActiveRecord::Migration + def up + change_column :custom_fields, :min_length, :int, :default => nil, :null => true + change_column :custom_fields, :max_length, :int, :default => nil, :null => true + CustomField.where(:min_length => 0).update_all(:min_length => nil) + CustomField.where(:max_length => 0).update_all(:max_length => nil) + end + + def self.down + CustomField.where(:min_length => nil).update_all(:min_length => 0) + CustomField.where(:max_length => nil).update_all(:max_length => 0) + change_column :custom_fields, :min_length, :int, :default => 0, :null => false + change_column :custom_fields, :max_length, :int, :default => 0, :null => false + end +end |