duplicate keys in CollectionVersionBlockStyles
Permalink
I'm not sure if anyone else has run into this issue previously. I recently upgraded a clients c5 install and afterwards whenever they would update a block (or add one) all the content on the page would disappear.
I tracked it down to a duplicate key issue on the CollectionVersionBlockStyles table. It looked like the Block::$csrID wasn't being set properly. To get around the problem (bandaid?), I changed /concrete/models/block.php around line 398 and added an if block around the insert.
After that the symptoms went away, but it doesn't feel like a good solution. Does anyone have a better solution?
I tracked it down to a duplicate key issue on the CollectionVersionBlockStyles table. It looked like the Block::$csrID wasn't being set properly. To get around the problem (bandaid?), I changed /concrete/models/block.php around line 398 and added an if block around the insert.
// styles if ($this->csrID) { $db->Execute('insert into CollectionVersionBlockStyles (cID, cvID, bID, arHandle, csrID) values (?, ?, ?, ?, ?)', array( $cID, $cvID, $this->bID, $this->getAreaHandle(), $this->csrID )); }
After that the symptoms went away, but it doesn't feel like a good solution. Does anyone have a better solution?
next time I'll start searching earlier ;)