2

I have a decimal field (ie field_testing) with precision = 10 and scale = 8. I need to change the precision to 11. I was planning on writing a migration script that does the following:

  • Update field_config row with field_name = 'field_testing' -- set the 'precision' field to 11.
  • Alter the field_testing table structure to adjust the precision of the 'field_testing_value' field to 11.

Few questions related to this:

  1. Given that I run this while in maintenance mode, is this safe to do?
  2. Is there anything else I need to do? The default values is and will still be blank, so changes need to go into field_config_instance, I think.

Thanks, Larry

2 Answers 2

1

Larry, On the Drupal side, those are the only changes you need to make, the field_config_instance table doesn't track the data specifications. Just don't forget to clear the cache_field table, and the MySQL tables themselves too.

0

Just changing the field data and field data revisions tables does not appear to be all that is needed.

I went through this and ran drush cc all when I go to:

/admin/structure/types/manage/company/fields/field_[rest of field name]

I am presented with the old precision value still. It appears field_config also needs to be updated but I am not sure how to best change the data column. This appears to be a better solution which I have not implemented yet.

trying to change field type through sql: Notice: Undefined index: precision in number_field_schema()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.