* Adjust the project field of the zt_bug table.

This commit is contained in:
tianshujie98
2021-03-11 17:36:21 +08:00
parent 57d5990c68
commit 11d818c80f
+26
View File
@@ -636,6 +636,10 @@ class upgradeModel extends model
$this->saveLogs('Execute 15_0');
$this->execSQL($this->getUpgradeFile('15.0'));
$this->appendExec('15_0');
case '15_0_beta1':
$this->saveLogs('Execute 15_0_beta1');
$this->adjustBugOfProject();
$this->appendExec('15_0_beta1');
}
$this->deletePatch();
@@ -4563,4 +4567,26 @@ class upgradeModel extends model
return true;
}
/**
* Adjust the project field of the zt_bug table.
*
* @access public
* @return bool
*/
public function adjustBugOfProject()
{
$bugs = $this->dao->select('id,execution')->from(TABLE_BUG)->fetchAll('id');
$executions = $this->dao->select('id,project')->from(TABLE_EXECUTION)->fetchAll('id');
foreach($bugs as $id => $bug)
{
if($bug->execution == 0) continue;
$data = array();
$data['project'] = $executions[$bug->execution]->project;
if($data) $this->dao->update(TABLE_BUG)->data($data)->where('id')->eq($id)->exec();
}
return true;
}
}