Drupal 6: restoring default content types
I swear I don't remember deleting the "story" and "page" content types. Maybe the Aegir installation profile did something creative. Maybe I did it and have since forgotten. Anyway I need both of those content types back on my dev server for testing. What now?
According to this ancient post by Richard Eriksson it can't be done. Technically he's right in the sense that there are no "restore default content types" buttons hiding in the admin interface for CCK or whatever but that doesn't mean they can't be restored.
I spent a little time digging around in a D6 database that still had the story and page content types and CCK installed. Here's what I found:
Page:
mysql> select * from node_type where type = 'page' \G;
*************************** 1. row ***************************
type: page
name: Page
module: node
description: A <em>page</em>, similar in form to a <em>story</em>, is a simple
method for creating and displaying information that rarely changes, such as
an "About us" section of a website. By default, a <em>page</em> entry does not
allow visitor comments and is not featured on the site's initial home page.
help:
has_title: 1
title_label: Title
has_body: 1
body_label: Body
min_word_count: 0
custom: 1
modified: 1
locked: 0
orig_type: page
1 row in set (0.00 sec)
Story:
mysql> select * from node_type where type = 'story' \G;
*************************** 1. row ***************************
type: story
name: Story
module: node
description: A <em>story</em>, similar in form to a <em>page</em>, is ideal
for creating and displaying content that informs or engages website visitors.
Press releases, site announcements, and informal blog-like entries may all be
created with a <em>story entry. By default, a <em>story</em> entry is
automatically featured on the site's initial home page, and provides the ability
to post comments.
help:
has_title: 1
title_label: Title
has_body: 1
body_label: Body
min_word_count: 0
custom: 1
modified: 1
locked: 0
orig_type: story
1 row in set (0.00 sec)
Restoration
After a quick bit of testing it looks like these content types can be restored simply by inserting the listed values into the node_type table. Of course this won't bring back any nodes that where deleted when the content type was removed, but you can't have it all, right?
- freeman's blog
- Login or register to post comments

I've seen this happen several times-- just inherited a site without the core types in D6. Not sure how it occurs because they are "locked."
db insertion would not work for me-- they showed up in the list, but not at /node/add. I manually restored from the descriptions above. Not sure if there are negative consequences to either method.
Ken Thomas
http://www.1kenthomas.com
- Login or register to post comments
Submitted by 1kenthomas on Sun, 02/28/2010 - 19:27.