Import new nodes via script

Just some notes for my own sake.

Some notes regarding importing to nodes using scripts e.g when migrating from one db to another

  • Using the wrong format in node_revision table can make users in some user roles not be able to access the nodes. I had set format to 2. When editing node as admin and save it it changed to format = 0, and then all user with the right permission could access.
    update `node_revisions` set `format` = 0 WHERE nid IN(select nid from node where type like "my_node_type")