From 11d818c80ffb587a97704fdd3a748dfbe91c8a85 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Thu, 11 Mar 2021 17:36:21 +0800 Subject: [PATCH] * Adjust the project field of the zt_bug table. --- module/upgrade/model.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 90df57c4de..83916c1ad9 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -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; + } }