1

in a very stupid action, I accidentally deleted the "Story" content type which had a lot of content. Just to be clear: I didn't delete the content, only the content type. When I realized what I was doing, I pressed esc, so I got a drupal message that very few content types were deleted. Still, much of the content is not in the back up. I am checking whether I can restore some of the lost content.

Apparently the titles of all stories appear normally. Unfortunately the body content is missing. I recreated the content type manually and still nothing. But when I looked in the database, I noticed that sql tables node, field_data_body and field_revision_body actually contain the content from the nodes that were deleted.

Going further, I realized that the database entries of these sql tables have a column deleted which was set to 1 for the 'story' entries. I found an article which explains how deleted fields stay in the database and suggests to set the value of the column back to 0, if you want your deleted fields back. I did that, but still the stories display only the title and not the body.

I also looked at mysql table "node_type" and story is there. It looks exactly like page.

What can I do to convince drupal to display again the body of the stories, as it is still in these fields in the database?

  • I assume you have no backup? In such a case, quickly rolling back to the last known good backup is definitely easier than messing around with the database. – Patrick Kenny Jul 31 '13 at 4:46
  • Also, don't even think of running cron. It will delete the data in the fields marked as deleted. – Pontus Nilsson Jul 31 '13 at 8:04
  • Hi. As I wrote clearly on the first paragraph I want to recover content which is not on the backup. – lefterav Jul 31 '13 at 10:17
  • Why won't you just rollback from backup? – Mołot Aug 13 '15 at 19:18
3

I had this same situation - deleted nodes, only titles left.

With D7, I used phpmyadmin to go into the database

open the field_data_body table

Sort this by type and locate the type you deleted - there should be a "1" in the deleted column. I did two as a test and then cleared caches and checked the node on the site - the content was back.

Then I ran this sql query, copied from the changes I did: UPDATE databasename.field_data_body SET deleted = '0' WHERE field_data_body.entity_type = 'content type name' AND field_data_body.deleted =1

Everything was back. Yay!

change database name to your database and content type name to the content type you deleted.

And be sure to backup your DB before doing this in case of disasters. Like deleting a node type.

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.