Due to a bug in 5.1 (see http://drupal.org/node/115689 ) I have inadvertently over-written the standard 'book page' content type.
I created a 'book review' content type using CCK and unfortunately chose 'book' as it's machine name - Drupal 5.1 does not currently warn that that machine name already exists - hence the bug report.

I went back to the 'book review' content definition and changed the machine name to 'review' - which it has - but now 'book review' is in the place where 'book page' used to be in create content and administer content types pages.

My previously created book pages are still available but in the node table the type appears as 'review' not 'book' although review is listed as being based on the book content type.

I now have no 'book page' option on the create content list or in the administer content types list.

I have tried to correct this by editing the database tables.
I have restored the table structure and contents of the table node_type replacing the book type at the place it was originally and adding my new review type at the end.
I have recreated the node_book table definition
and added the node_review table definition and content for my new content type.

My new review content type is available but I still do not have the book page type in either create content or administer content types.

What more should I do to restore the book type?

Comments

catch’s picture

I've not come across this problem before but could you not just rename "review" back to book, then create a new content type called review? I can't see a reason why this wouldn't behave in the same way as if you'd not changed it in the first place - assuming all your content is still accessible ok in the "review" content type.

tam’s picture

because wouldn't that only change the name leaving the new 'review' definition intact. The problem was that my new content type over-wrote the definition of the original book type. - I am not sure where to find all the references that define that to recreate the book type.

And a resolution for a better database backup policy - I have one - but not as recent as I would like so I am trying to restore the definition without losing the most recent content. I am assuming that all the information is in the database, I don't know that for sure.

Thanks for your help.

tam’s picture

but encountered errors:

* user warning: Duplicate entry 'book' for key 1 query: UPDATE drjc1_node_type SET type = 'book', name = 'Book page', module = 'node', has_title = 1, title_label = 'Title', has_body = 1, body_label = 'Synopsis or review', description = 'Give details of a book. A review may be included.', help = 'Use this content type to recommend a book. You must give a book title and, if possible, the author/s. Add any other publication details that you know. The synopsis/review text area can be used to add a short description or review of the book.', min_word_count = 0, custom = 1, modified = 1, locked = 0 WHERE type = 'review' in [...]includes/database.mysql.inc on line 172.
* user warning: Can't find file: '[...]node_review.frm' (errno: 2) query: RENAME TABLE node_review TO node_book in [...]/includes/database.mysql.inc on line 172.

The effect was to lose the fields and layout I had defined for the review type and it reverted to the book format of just title and body - but all the comments I had put in to the new review type remained - the original book type did not reappear - and the Name and type fields remained 'sticky' - not changing to 'book' as I had tried to rename them.

I will be able to clean up the database to remove my new review definition - but how do I get the full book type back?

catch’s picture

Ah OK, I wasn't aware you'd already customised the content type. In that case why not install a clean 5.1 copy of drupal locally or in a subdomain, then compare the db structure for the original book type and your altered one?

tam’s picture

I'll try that.

tam’s picture

I tried altering the data in type definitions etc. in comparison with the tables of a fresh install - it did not work. I also reinstalled Drupal 5.1. files - which also made no difference. My new 'review' type with its changed machine name name 'review' stayed in the place of the list where the 'book' type used to be. Eventually, I deleted the review type - and the original 'book' type reappeared.

I then recreated the review type and added fields - that already existed from my first definition of that content type. I had to add data for some of them to the few pages that I had already created using that type.

So all's well now.

Thanks for the help.