Act before node deletion.
This hook is invoked from entity_delete_multiple() after the type-specific hook_delete() has been invoked, but before hook_entity_predelete() and field_attach_delete() are called, and before the node is removed from the node table in the database.
\Drupal\Core\Entity\EntityInterface $node: The node that is about to be deleted.
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
function hook_node_predelete(\Drupal\Core\Entity\EntityInterface $node) {
db_delete('mytable')
->condition('nid', $node->nid)
->execute();
}