This project is read-only.

Understanding Content IDs and Types in the Database

Topics: Core, Writing modules
Jun 26, 2012 at 3:14 PM
Edited Jun 26, 2012 at 3:15 PM

I just wrote a new content part that has a record table in the database, but I want to initialize the data for all my content depending on content type, so I'm writing a db script that simply inserts rows into my record table.

My record table has an Id field, which looks like it matches up with the Id field in Orchard_Framework_ContentItemRecord, which appears to be the master table for all content in the system.

Now, in that table, there is also a ContentType_id field, which seems to correspond with Settings_ContentTypeDefinitionRecord. However, I've noticed an odd thing, all of the "pages" (imported through the Import/Export tool) are listed as the content type of "layer". If I query the database using the "page" content type, my site has only 6 pages- through the UI there are 580 (which corresponds to the number of "layers" if I query the db for those).

My question is twofold- first, am I understanding these database relationships correctly? Second, is this page vs. layers thing by design? Something I should be concerned about?

Jun 27, 2012 at 2:30 AM

Short version: don't.

Long version: you should script the application through the command-line, or write code that talks to the ContentManager rather than try to hack into the database, which is sure to be a frustrating and ultimately full of fail experience.