This is the documentation for concrete5 version 5.6 and earlier. View Current Documentation

A number of concrete5 users reported trouble editing blocks after they'd upgraded their sites from 5.3.3.1 to 5.4.0, resulting in the following error:

Fatal error: Uncaught exception 'ADODB_Exception' with message 'mysql error: [1062: Duplicate entry '12-1' for key

'PRIMARY'] in EXECUTE("insert into CollectionVersionBlockStyles (cID, cvID, bID, arHandle, csrID) values ('1', '86', '12',

'Main', 0)") ' in /home4/fltconfe/public_html/trails/concrete/libraries/3rdparty/adodb/adodb-exceptions.inc.php:78 Stack

trace: #0 /home4/fltconfe/public_html/trails/concrete/libraries/3rdparty/adodb/adodb.inc.php(1037): adodb_throw('mysql',

'EXECUTE', 1062, 'Duplicate entry...', 'insert into Col...', false, Object(ADODB_mysql)) #1......

Community member stromberg found a solution that makes the required database changes. Here's a summary of what you'll need to do.

First, back up your site's database. We'll need to make some alterations to it, so it's essential that we've got a safe copy of it.

Open whatever tool you use to edit your database (command line, phpMyAdmin, etc). If your site is installed on a linux platform, run the following SQL command:

ALTER TABLE `CollectionVersionBlockStyles`
  DROP PRIMARY KEY, 
    ADD PRIMARY KEY( `cID`, `cvID`, `bID`, `arHandle`);
ALTER TABLE `CollectionVersionBlockStyles` 
  MODIFY COLUMN `bID` INTEGER UNSIGNED NOT NULL DEFAULT 0, 
  MODIFY COLUMN `cID` INTEGER UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE `PagePaths` 
  ADD KEY `cPath` (`cPath`(128)); 
ALTER TABLE `CollectionVersions` 
  ADD KEY `cvName` (`cvName`(128));

If your site is running on a different platform (Windows / etc), you may need to change the table names to all-lowercase:

ALTER TABLE `collectionversionblockstyles`
  DROP PRIMARY KEY, 
    ADD PRIMARY KEY( `cID`, `cvID`, `bID`, `arHandle`);
ALTER TABLE `collectionversionblockstyles` 
  MODIFY COLUMN `bID` INTEGER UNSIGNED NOT NULL DEFAULT 0, 
  MODIFY COLUMN `cID` INTEGER UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE `pagepaths` 
  ADD KEY `cPath` (`cPath`(128)); 
ALTER TABLE `collectionversions` 
  ADD KEY `cvName` (`cvName`(128));

To read the original solution thread, click here.

Many thanks to stromberg for posting his fix!

Loading Conversation