Skip to content

Instantly share code, notes, and snippets.

@krschmidt
Created March 24, 2018 06:22
Show Gist options
  • Save krschmidt/4328832ee13d4c3118a2e38c625d26a9 to your computer and use it in GitHub Desktop.
Save krschmidt/4328832ee13d4c3118a2e38c625d26a9 to your computer and use it in GitHub Desktop.
Converting Drupal 7 field types
update field_config set type='text_long' where field_name='field_a' or field_name='field_b';
alter table field_data_field_a modify field_a_value longtext;
alter table field_data_field_b modify field_b_value longtext;
alter table field_revision_field_a modify field_a_value longtext;
alter table field_revision_field_b modify field_b_value longtext;
# adjust 4096 to your length, and change s to match the number of characters in the length.
update field_config set data=replace(data, 'a:1:{s:10:"max_length";s:4:"4096";}', 'a:0:{}') where field_name='field_a' or field_name='field_b';
update field_config_instance set data=replace(data,'s:14:"text_textfield";','s:13:"text_textarea";') where field_name='field_a' or field_name='field_b';
# adjust 60 to the edit field length, and change s to match the number of characters in that field length
update field_config_instance set data=replace(data,'s:4:"size";s:2:"60";','s:4:"rows";s:1:"5";') where field_name='field_a' or field_name='field_b';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment