Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Restoring database I can no longer save pages


Go to End


3 Posts   1253 Views

Avatar
obj63mc

Community Member, 25 Posts

3 February 2010 at 7:30am

Hi All,

I have a site on a dev environment and when I go to set this up on production so users can edit articles, and create new ones, when ever you go to save or save and publish the cms errors out stating it "Error saving content" The actual error is -

500 Warning: "mysql_query() [<a href='http://www.mysql.com/doc'>http://www.mysql.com/doc</a>;]: Duplicate entry '351' for key 1" at line 95 of C:\htdocs\education-center-2\sapphire\core\model\MySQLDatabase.php

When I moved to production though all I did was create a mysql dump from dev and then restored it in production. I can view the site all content everything fine just for some reason now all the indexes are messed up and now I can't save content add content etc.

Any idea how to fix the indexes so this will save properly or why when simply restoring the database this would happen?

Avatar
obj63mc

Community Member, 25 Posts

3 February 2010 at 8:00am

To update this I have done some more testing. If I make simple changes to x to many relation ships for say appending a related page, or updating an image, if I press save and publish the page will save and publish but it still is throwing the same error as before.

If I make a change to say the content section this will save to the draft version (SiteTree) but won't update SiteTree_Live. Then If I go to batch actions and publish it will throw the same error again but it will save this time and publish it.

Any idea why it is always throwing this error even though it is working or how I can trace down all the sql statments run.

Avatar
obj63mc

Community Member, 25 Posts

3 February 2010 at 11:20am

So I have been doing some tracing and logging of all the sql queries that SilverStripe is running for some reason this is running an update statement then an insert statement for the same id to the same table right after one another.

Attached are all the queries ran when trying to save and publish. Any idea why this would happen?

Attached Files