
One of the most basic things in Drupal is the concept of a node. This article will give an overview of Drupal nodes so administrators and developers can get a better sense of it.
For those who know object oriented programming, this should be easier to grasp. A Drupal node is in essence an object.
Imagine that you wanted to create a website offering reviews of movies. You have access to several standard Drupal node types to create your content. You can write a story, create a blog, or even roll your own custom Drupal movie node.
In object oriented design, you would write down all the nouns in the application like movie title, actors, and producers. You could use the Drupal movie node by creating it with the very handy Content Construction Kit (CCK).
Every Drupal node has properties, just like objects:
Notice that there is no mention of the actual data the node stores. This is because Drupal has a versioning system that lets authors store revisions of the Drupal node. In the node definition above is the version identifier. This identifies the current node.
To get a better handle on this, lets say you want to write a story about Drupal programming. If you write a draft of a story you can mark it with revision information "draft" when you add the node the first time. Then when you come back later to polish the story, you can give it version "1.0". In this case, two copies of your story will be stored in the database. But how does Drupal know which version is current?
The last version is the current version and is held in the version identifer in the properties above.
The node_revisions database table holds the node data. It has the following properties:
When nodes are created, the node id and the version id are the same. As revisions are made the version id changes and refers to a version node in the revisions table. You can never delete the current version but can delete older versions.
That's pretty much the basics of Drupal nodes. Many people get confused on what nid and vid is in the database tables. Now you know!