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.
// 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?

triplei
 
triplei replied on at Permalink Reply
triplei
and it's at this point that I noticedhttp://www.concrete5.org/community/forums/installation/error-upgrad... which looks suspiciously similar.

next time I'll start searching earlier ;)