I need to change one of the fields of a type of a node from a free-form text to be a taxonomy term, but the data already has about 250,000 records.
How can I change this field type without losing the existing data?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
Changing the field type as you asked is not possible.
However a possible alternative to achieve a similar result is like so (in the order specified):
before saving content.
entity has field, with field = the old field.
entity has field, with field = the new field).
set Drupal message, which contains some instructions that the old field must be blanked out, and the new field should contain the appropriate value(s.
Obviously, this approach will take "some" time if this has to be done manually, 1 node at a time. But using Views (to build a list of similar nodes to be updated) and VBO (to mass update such lists) you might (should!) be able to speed up this process quite a bit. Refer to my answer to "How to bulk update select list fields?" for an example with way more details about that.