function comment_upload_update_1 in Comment Upload 5
Same name and namespace in other branches
- 6 comment_upload.install \comment_upload_update_1()
File
- ./
comment_upload.install, line 40
Code
function comment_upload_update_1() {
$ret = array();
$ret[] = update_sql("ALTER TABLE {comment_files} ADD nid int NOT NULL default '0'");
// loop through all the comment upload records and populate the nid column
$results = db_query("SELECT c.cid, c.nid FROM {comments} c WHERE c.cid IN (SELECT DISTINCT cf.cid FROM {comment_files} cf)");
while ($c = db_fetch_object($results)) {
$ret[] = update_sql("UPDATE {comment_files} SET nid = {$c->nid} WHERE cid = {$c->cid}");
}
return $ret;
}