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.

Upgrading SilverStripe /

Ask questions about upgrading SilverStripe to the latest version.

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

Problem with Index RecordID_Version

Go to End

6 Posts   1910 Views


Community Member, 3 Posts

1 August 2010 at 2:36am

Edited: 01/08/2010 2:57am

After upgrading to 2.4.1 when rebuilding the database every time I get for every one of my page types the following message:

Index MenuPage_versions.RecordID_Version: changed to unique (RecordID, Version) (from unique (RecordID,Version))

This happens not only the first run but every time.

And when saving an existing page in the backend for the first time after the upgrade I get "Error saving content" and the following error in the log:

[31-Jul-2010 04:16:42] Error at \sapphire\core\model\MySQLDatabase.php line 536: Couldn't run query: 
INSERT INTO "MenuPage_versions" ( .... , 150, 9) 

Duplicate entry '150-9' for key 'RecordID_Version' (http://fd2.deepthought/admin/EditForm)

When saving it the second time (and all subsequent times) all works fine.

I'm a little stuck, so any help would be appreciated.


Community Member, 130 Posts

5 August 2010 at 11:11am

Edited: 05/08/2010 2:56pm

I'm having the same problem from a fresh download of 2.4.1

I believe it happened after I deleted a controller, then rebuilt the database, then re-instated the controller and tried to rebuild the database again. Now I get the same error over and over.

EDIT: Every page controller I add, now has the same errors, but pages I added previously don't. Notice the "HomePage" below is fine.

I tried the suggestion here to rebuild the ClassNames. Which it worked on the Sitetree but not on the Sitetree_Live, see attached pic.

Does anyone know if this changed in the 2.4.0 to 2.4.1 update?

# ErrorPage
# Index ErrorPage_versions.RecordID_Version: changed to unique (RecordID, Version) (from unique (RecordID,Version))
# RedirectorPage
# Index RedirectorPage_versions.RecordID_Version: changed to unique (RecordID, Version) (from unique (RecordID,Version))
# VirtualPage
# Index VirtualPage_versions.RecordID_Version: changed to unique (RecordID, Version) (from unique (RecordID,Version))
# FootLink
# Index FootLink_versions.RecordID_Version: changed to unique (RecordID, Version) (from unique (RecordID,Version))
# Footer
# HomePage
# ThisPage
# Index ThisPage_versions.RecordID_Version: changed to unique (RecordID, Version) (from unique (RecordID,Version))



Community Member, 130 Posts

5 August 2010 at 3:53pm

just uploaded a fresh 2.4.0 (just the core files, i left mysite and themes and the database intact) and it solves the issue. well, it doesn't "solve" it, but I can use the sql commands from the previous post and now my errors are gone.




Community Member, 89 Posts

24 August 2010 at 12:22am

Edited: 24/08/2010 12:23am

I am having exactly the same problem, often when saving a page in the CMS it says error, but then works the second time. The error produced is:

Error: Couldn't run query: INSERT INTO "Page_versions" ("[...]", "RecordID", "Version") VALUES ('0', '0', null, 2, 238) Duplicate entry '2-238' for key 2
At line 536 in [...]/sapphire/core/model/MySQLDatabase.php 

And I also always get the "Index [...]_versions.RecordID_Version: changed to unique (RecordID, Version) (from unique (RecordID,Version))" when doing a dev/build.

Has the 2.4.1 bug been identified yet?


Community Member, 12 Posts

24 August 2010 at 2:07pm

not sure if its identified, this was the only reference Ive found so far.

But will just throw in my confirmation that I encountered a similar issue and had to revert to 2.4.0.
Was throwing duplicate errors on product->writeToStage("Stage'); calls in the ecommerce module I use.

After reverting to 2.4.0, the error was gone


Forum Moderator, 5523 Posts

24 August 2010 at 9:14pm

Sounds like the same as the issue I had recently -

I put it down to workflow but something else could be triggering the same issue.