Hey,

Im in middle of building the basics of a news driven site, and need to import data across.

I cant seem to find anything explaining the layout of the node tables., I know that:

node
node_revisions
term_node

Are the 3 key tables which control content, node is pretty self explanatory, however I dont understand node_revisions and term_node!

Explanations would be great.

Comments

superjacent’s picture

The table "node_revisions" basically holds the actual content of your posts, both teaser and body. The table "node" stores what I would call the header information of a post entry, such as the Title and creation date etc. Between the 'node' and 'node_revisions' tables it's a one to many relationship, that is one node many node_revisions.

Have a look at the sequences table, that plays an important part in keeping track of various primary keys.

I've purely gone from memory with the above and when I get back to my Wordpress import project I can be a lot more specific.

Hope this helps in the interim.

___________________________

Steven Taylor
Melbourne, Australia.
http://superjacent.net/cms

nextgengames’s picture

Yeah it does a little.

Basically I just got given a Excel sheet of a MSQL Table with all the content they want into the Drupal Site.

I dont want to make a mistake which causes drupal to die as my database keys are out of whack or something!

Ill work on basic import script now, and work on getting my term mapping sorted later.

Phillip Mc’s picture

Why not use the node_import.module?

Works great with CSV files (which is a standard MYSQL export option) and it takes care of all the database stuff for you...

Phil

nextgengames’s picture

Because it doesnt support stuff properly, eg dates I believe ?

Now I've a stupid error after importing all my content, I get the "Welcome to Drupal" page on the frontpage and when I go to create a new content I get warning and it doesnt create.

user warning: Duplicate entry '30' for key 2 query

I deleted via the Drupal admin my original content before I did the import and am now stuck!

Help appreciated!

Phillip Mc’s picture

You need to update the node count in the variables table. I think it should be set to the last node ID..so when a new node is added to the site Drupal knows what node ID to assign it. Hence the duplicate entry error.

Go to admin -> content and browse to the last page to get the node ID of the last node...then open up your mysql table and go to the variables table (it maybe called the sequences table) and then edit the node counter.

Incidentally, I've never had a problem with dates using the node import module. Just run a test first so you have the dates in the correct format in excel before importing the CSV file. i.e.under the cell properties option in excel, you can specify what date format you want the date column set at.

Phil

Edited: I think it's called the sequences table...do a search on here and there's bound to be someone else who had the same issue.

nextgengames’s picture

I managed to get content posting working, however I still havent managed to get the frontpage showing any content.

Help Appreciated!

superjacent’s picture

I'm suspecting you haven't added the data to the teaser field of table node_revisions. Data for the front page is extracted from the teaser field and not the body field.

___________________________

Steven Taylor
Melbourne, Australia.
http://superjacent.net/cms

superjacent’s picture

I'm suspecting you haven't added the data to the teaser field of table node_revisions. The data for the front page is extracted from the teaser field and not the body field.

___________________________

Steven Taylor
Melbourne, Australia.
http://superjacent.net/cms

superjacent’s picture

I'm suspecting you haven't added the data to the teaser field of table node_revisions. Data for the front page is extracted from the teaser field and not the body field.

___________________________

Steven Taylor
Melbourne, Australia.
http://superjacent.net/cms

nextgengames’s picture

Thanks to everyone who helped!!

The front page issue was related to no content being set as promoted!

This has now been resolved!