importing content - what should the node vid value be?
I'm converting an old bespoke forum to drupal, and am in the process of creating new forum nodes (from what were the topic starters on the old site)
Most of the fields from the old database map pretty logically to the drupal fields, but the vid field in the node table is tripping me up.
What, exactly, is it referencing? The test nodes I created using the Drupal interface itself gave me these results (with various non-relevant fields not shown)...
nid | type | title | vid
5 | forum | test1 | 6
6 | forum | test2 | 7
7 | forum | test 3| 8
If I enter a new node using a sql insert via phpmyadmin, eg...
10 | forum | new1 | [x]
I can't get [x] to be any value that gets the node to work (unless I make it an existing vid number from another row - in this case 6,7 or 8, in which case the node from that row gets displayed instead).
I'm guessing there's another table where some details need to go into to get the node working correctly?
Any pointers appreciated.

vid = reVision ID. With 4.7,
vid = reVision ID. With 4.7, the actual content of standard nodes is stored by revision, meaning you get it from the node_revisions table, not from the node table: tne node table only stores summary information, like the title, creation date, last change date (from the latest node_revision change), and so on.
So for each node, you must create a node_revision entry. The safest way is to invoke
node_insert()instead of inserting into the DB yourself.thanks
excellent. thanks.
remove
remove
Column order was confusing me
Thanks for the post. The order of columns in NODE_REVISIONS confused me. It is more typical to see the PRMIARY key listed first in the column list. Thanks for the post, it has helped me.
Earnie Boyd
http://For-My-Kids.Com
http://Give-Me-An-Offer.com
http://AffiliationMaster.com
node_insert not found in api.
Hi, where I can get info about node_insert() function ???
In the api.drupal.org site there is nothing about it.
Tnx.
Its actual name is
Its actual name is
node_save(), notnode_insert()(slight confusion withhook_insert()which is fired at some point when doing anode_save()).useful for batch processing
This is useful information for anyone else who (like me) needs to do batch processing with php, perl or other scripting languages, automatically adding content to the drupal database by way of a batch file or scripting language, and has had difficulty.
Its hard to find this information otherwise so am just tagging this thread for easier search: php, perl, automatically add drupal nodes, automate node addition, automate content addition, batch scripting, command line, add drupal content, node does not appear.
it is used in
(in 4.6)
Table book
Table vocabulary
Table vocabulary_node_types
Table term_data
and maybe one or two others.
I think if you are just uploading sql INSERT queries you just need to set each new vid to be +1 on the last vid.
The vid is then used to tie up with 'vocabulary' and 'books' mainly.
If you later set up vocabularies or books on your site you then reference the vid for each node. (more sql magic required then is all)
Does that make sense?
wellsy
orchidsonline.com.au
I need to export my old
I export the data of my old database to my new database, i export the data os the tables node and book, but the content not appears in my site. It lacked I to export given to plus some table?
And finally .. which the
And finally .. which the best way to get 'vid' from node_revisions to my book and node tables?
I try:
select *
from node_revisions nr, node n, book b
WHERE nr.nid = '153' // (i have this id in my node table throught of this query: select * from node where type = 'book')
and nr.nid = n.nid
and n.type = 'book'
and n.vid = b.vid
The query above returns many results. Which would the best way of I make this query?