Today I moved a bunch of cases from public to private state using a handy little script that did:

$node = node_load($nid);
$node->private = 1;
node_save($node);

This had the interesting side effect of unassigning all cases.

I'm not exactly sure why/how, but wanted to document the case.

My solution to get back the data was the following set of queries:

create table gjktrash (assign_to int, cid int, nid int, state int, vid int);

insert into gjktrash select assign_to, cc.cid, nid, state from casetracker_comment_status cc inner join (select max(cid) AS cid, comments.nid from comments inner join node on comments.nid = node.nid where node.type = 'case' group by nid) sub on cc.cid = sub.cid where state = 1;

update gjktrash g , (select max(vid) as vid, nid from casetracker_case group by nid) cc set g.vid = cc.vid where g.nid = cc.nid;

 update casetracker_case cc, gjktrash g set cc.assign_to = g.assign_to where cc.nid = gjktrash.nid and cc.vid = g.vid;

I'm sure this could be done in a simpler manner - but this worked for me. It also doesn't update cases without comments (but those are rare enough for me).

Comments

zero2one’s picture

Status: Active » Closed (fixed)
greggles’s picture

So...you have no desire to even try to reproduce this bug?