0

I did something where everybody said never ever do it: some weeks ago I deleted records from the node- and/or node_revision tables manually (DELETE FROM TABLE ...), and thought it won't harm. But now I see that it definitely did harm, as my search function doesn't work anymore the way it should be.

Is there something I could repair or very hard to recover?

Many thanks for help.

1 Answer 1

1

Oh dear, as you suspect that's not great. The outlook is probably quite bleak I'm afraid, a few vague possibilities:

  • If you know exactly what you deleted manually, restore it manually.
  • If you're able to restore a backup to another database, and cherry pick the records you deleted from that to be restored manually to the original DB, and depending on what damage those missing records have done in the meantime, that would possibly be an option.
  • If restoring the whole database from a backup is an option, do that.
  • If you know the IDs of the nodes you deleted, stick some dummy data with the appropriate IDs into the node/node_revision table, then call node_delete_multiple with the IDs so the system deletes them properly (clear the cache first).

The main problem with deleting straight out of the node table is that you leave a lot of orphaned data elsewhere - Drupal has no enforced referential integrity apart from some 'soft' checks in code for certain operations.

The most important thing to take away from this is never touch the database unless you're 100% confident what you're doing is safe. But I reckon you've probably learned that already :)

1
  • Oh my goodness. I am very stupid. The thing is there is a lot of traffic and new data generated already. Bummer. If I'd restore from an older SQL I'd be dead (or at least half-dead). The whole thing mainly concerns the search. What I found is that in /root/module/search.module the function search_dirty() doesn't return values, so in order to update the search_total table. But I don't understand the search_dirty()
    – Selim
    Jan 19, 2016 at 10:54

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.