0

I need to change the Text format of the body field of 200 node of the "flats" content type.

I guess I can do it in the database but I don't know where to look.

3
  • Is this for Drupal 6 or 7?
    – Clive
    Jul 27, 2012 at 10:50
  • 1
    drupal 7. Right now I will try: update field_data_body set body_format =REPLACE(body_format, 'plain_text', 'full_html');
    – chefnelone
    Jul 27, 2012 at 10:58
  • 1
    Yeah that's how I'd do it too, remember to clear the caches after you're done so the changes get picked up. Maybe add a WHERE entity_type = 'node' AND bundle = 'flats' so you don't update it for the wrong content type
    – Clive
    Jul 27, 2012 at 11:04

1 Answer 1

0

The query you suggested is great but if you want to make sure you're only including body fields from the content type you want to update you need to extend it slightly:

UPDATE field_data_body 
SET body_format = REPLACE(body_format, 'plain_text', 'full_html')
WHERE entity_type = 'node' AND bundle = 'flats'

You'll also need to run the same query for the field_revision_body table or nothing will happen:

UPDATE field_revision_body 
SET body_format = REPLACE(body_format, 'plain_text', 'full_html')
WHERE entity_type = 'node' AND bundle = 'flats'
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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