diff --git a/db/update16.0.beta1.sql b/db/update16.0.beta1.sql index 6634ac2b81..0ad3e88553 100644 --- a/db/update16.0.beta1.sql +++ b/db/update16.0.beta1.sql @@ -5,3 +5,5 @@ ALTER TABLE `zt_task` ADD `v1` varchar(40) NOT NULL AFTER `lines`; ALTER TABLE `zt_task` ADD `v2` varchar(40) NOT NULL AFTER `v1`; ALTER TABLE `zt_task` ADD `mr` mediumint(8) unsigned NOT NULL AFTER `repo`; ALTER TABLE `zt_bug` ADD `mr` mediumint(8) unsigned NOT NULL AFTER `repo`; + +UPDATE `zt_grouppriv` SET `method`='addReview' where `module`='mr' and `method`='addBug'; diff --git a/module/mr/model.php b/module/mr/model.php index 9a577e46c5..33dbda8a56 100644 --- a/module/mr/model.php +++ b/module/mr/model.php @@ -793,7 +793,7 @@ class mrModel extends model */ public function getReview($repoID, $MRID, $revision = '') { - if(empty($repoID) OR empty($MRID)) return array(); + if(empty($repoID) or empty($MRID)) return array(); $reviews = array(); $bugs = $this->dao->select('t1.*, t2.realname')->from(TABLE_BUG)->alias('t1') diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 479f87c305..3ee0d81265 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -735,10 +735,6 @@ class upgradeModel extends model $this->updateObjectBranch(); $this->updateProjectStories(); $this->appendExec('15_7_1'); - case '16_0_beta1': - $this->saveLogs('Execute 16_0_beta1'); - $this->adjustPriv16_0_beta1(); - $this->appendExec('16_0_beta1'); } $this->deletePatch(); @@ -5408,24 +5404,4 @@ class upgradeModel extends model return true; } - - /** - * Adjust priv 16_0_beta1. - * - * @access public - * @return bool - */ - public function adjustPriv16_0_beta1() - { - $groups = $this->dao->select('`group`')->from(TABLE_GROUPPRIV)->where('module')->eq('mr')->andWhere('method')->eq('addBug')->fetchPairs('group', 'group'); - foreach($groups as $groupID) - { - $groupPriv = new stdclass(); - $groupPriv->group = $groupID; - $groupPriv->module = 'mr'; - $groupPriv->method = 'addReview'; - $this->dao->replace(TABLE_GROUPPRIV)->data($groupPriv)->exec(); - } - return true; - } } diff --git a/test/data/mr.yaml b/test/data/mr.yaml new file mode 100644 index 0000000000..4e8546582e --- /dev/null +++ b/test/data/mr.yaml @@ -0,0 +1,32 @@ +title: zt_mr +author: Yidong Wang +version: "1.0" +fields: + - field: id + range: 1 + - field: gitlabID + range: 1 + - field: sourceProject + range: 42 + - field: sourceBranch + range: branch-08 + - field: targetProject + range: 42 + - field: targetBranch + range: master + - field: mriid + range: 19 + - field: title + range: Test MR + - field: status + range: opened + - field: mergeStatus + range: can_be_merged + - field: repoID + range: 1 + - field: jobID + range: 0 + - field: compileID + range: 0 + - field: deleted + range: 0 diff --git a/test/data/repo.yaml b/test/data/repo.yaml new file mode 100644 index 0000000000..fee052df1d --- /dev/null +++ b/test/data/repo.yaml @@ -0,0 +1,20 @@ +title: zt_repo +author: Yidong Wang +version: "1.0" +fields: + - field: id + range: 1 + - field: product + range: 1 + - field: name + range: 723test + - field: path + range: 42 + - field: SCM + range: Gitlab + - field: client + range: 1 + - field: extra + range: 42 + - field: deleted + range: 0 diff --git a/test/data/zentao/config.php b/test/data/zentao/config.php index 2e0255f1b6..9c8e18a13c 100644 --- a/test/data/zentao/config.php +++ b/test/data/zentao/config.php @@ -31,3 +31,5 @@ $builder->case = array('rows' => 10000, 'data' => array('case')); $builder->bug = array('rows' => 100, 'data' => array('bug')); $builder->pipeline = array('rows' => 1, 'data' => array('pipeline')); +$builder->repo = array('rows' => 1, 'data' => array('repo')); +$builder->mr = array('rows' => 1, 'data' => array('mr'));