开发者

How to change the field type of some fields in D7 after a migrate

开发者 https://www.devze.com 2023-04-11 02:28 出处:网络
I would like to find out how to change the fi开发者_如何学JAVAeld type of fields in D7. I have just migrated from D6, and some of my imagefields are wrongly converted into file fields.

I would like to find out how to change the fi开发者_如何学JAVAeld type of fields in D7. I have just migrated from D6, and some of my imagefields are wrongly converted into file fields.

Some of my text fields are also wrongly converted into long text.

Please advice. Thanks!


If you are using CCK then you have to delete the field and create a new one with a new type (text, int, float)...

if you want to know how to do this programmatically see hook_form_alter


There are several solutions for this :

  1. Delete and then add the field again as mentioned
  2. Backup field tables, delete the field, add it again with your desired config, compare old field tables and new ones and apply the difference on the old table, then remove new tables and replace them by the old ones
  3. Modify field config via the database. as mentioned here https://drupal.stackexchange.com/questions/79378/changing-a-field-type-from-integer-to-decimal/101598#101598
  4. Create a new field and use migrate module or views bulk operation to move the data to the new field.

So, if you want to preserve your data, the easier and the fastest method is number 2. otherwise number 1

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号