Page 1 of 1

[solved] Can't create new pages after importing content into database

Posted: Sun Aug 05, 2007 5:59 am
by stevehong
Please help if you can.  I need to import almost a thousand pages of content into a CMSMS site, and I thought I knew how, but after importing pages directly into my database by inserting new rows, I can't properly create new pages in the CMSMS Admin Panel.  The problem appears to be that pages created in the Admin Panel are given sequential content_id values in the database.  I thought that CMSMS wouldn't try to use numbers of rows that already existed in the database (rows that I imported), but it does.  And the Admin Panel-created page doesn't even completely overwrite the database-imported page; only the database rows in the cms_content_props table are overwritten, and the cms_content table is left alone, meaning the hybrid page has the imported title but new content.  In short, I can import hundreds of pages into my database, but the site content will slowly fall to pieces and be partially overwritten as I use the CMSMS Admin Panel to create new pages.

Is there a way to fix or work around CMSMS' inability to assign truly unique content_id numbers to new pages created in the Admin Panel?  Is there a way to force the CMSMS Admin Panel to start using content_id numbers beginning at an arbitrarily high number to avoid interference with imported database rows?  Is there another way to import Excel/CSV data without interfering with CMSMS ability to update the pages?

Here is some additional background if it helps:
First, I'm mostly a front-end HTML and graphics guy, so I don't have much knowledge or experience working with databases or server-side scripting.  Please try to explain any answers to my question simply or with lower-tech options when possible.  I am using CMSMS 1.0.8 "Kona" and phpMyAdmin 2.8.0.1.  This is the first time I have tried editing a database using phpMyAdmin.

I imported data from an Excel spreadsheet that was converted to CSV format.  I was very careful to observe and figure out how to properly place data into columns that matched the database, so I'm reasonably certain that I correctly imported data.  The imported pages show up correctly in my site's navigation and in the CMSMS Admin Panel list of pages.  I think I properly advanced id and hierarchy number values.  I only added rows to the cms_content and cms_content_props tables.

Re: Can't create new pages after importing content into database

Posted: Sun Aug 05, 2007 3:12 pm
by tsw
page id's are generated according to value in cms_content_seq table (this is because some sql servers had problems with autoincrement columns)

UPDATE cms_content_seq SET id=(SELECT MAX(content_id) FROM cms_content);

should fix it.

Re: Can't create new pages after importing content into database

Posted: Sun Aug 05, 2007 9:02 pm
by stevehong
Thanks, tsw.  That's exactly what I needed to know.  I'm going to set the id of cms_content_seq to 1000 so I can import all of my content and not worry about id numbers conflicting.