Skip to main content
added 197 characters in body
Source Link
Vlad Vinnikov
  • 195
  • 1
  • 2
  • 9

Adding node_type condition as following:

db_update("node")
->fields(array(
  'comment' => 2,
  ))
->condition("type", "node_type", "=")
->execute();

I can run the above with drush scr filename.php

Alternatively I could update with SQL query:

UPDATE node as n LEFT JOIN node_revision as nr ON nr.nid=n.nid AND nr.vid=n.vid 
SET n.comment = 2, nr.comment = 2 WHERE n.type = 'notes';

Adding node_type condition as following:

db_update("node")
->fields(array(
  'comment' => 2,
  ))
->condition("type", "node_type", "=")
->execute();

Adding node_type condition as following:

db_update("node")
->fields(array(
  'comment' => 2,
  ))
->condition("type", "node_type", "=")
->execute();

I can run the above with drush scr filename.php

Alternatively I could update with SQL query:

UPDATE node as n LEFT JOIN node_revision as nr ON nr.nid=n.nid AND nr.vid=n.vid 
SET n.comment = 2, nr.comment = 2 WHERE n.type = 'notes';
Source Link
Vlad Vinnikov
  • 195
  • 1
  • 2
  • 9

Adding node_type condition as following:

db_update("node")
->fields(array(
  'comment' => 2,
  ))
->condition("type", "node_type", "=")
->execute();