* * Modify update sql of change story status.

This commit is contained in:
xieqiyu
2022-08-24 10:05:49 +08:00
parent e81b8552fe
commit 1db00037b4
2 changed files with 9 additions and 3 deletions
+1
View File
@@ -1,3 +1,4 @@
ALTER TABLE `zt_story` MODIFY `status` enum('','changed','active','draft','closed','reviewing') NOT NULL DEFAULT '' AFTER `estimate`;
UPDATE `zt_story` SET `status` = 'reviewing' WHERE `status` = 'changed';
ALTER TABLE `zt_story` MODIFY `status` enum('','changing','active','draft','closed','reviewing') NOT NULL DEFAULT '' AFTER `estimate`;
+8 -3
View File
@@ -7062,11 +7062,16 @@ class upgradeModel extends model
*/
public function updateStoryStatus()
{
/* After cancel the review of changed story, the story status should be 'changing'. */
/* After cancel the review of changed story, the story status should be "changing". */
$this->dao->update(TABLE_STORY)->set('status')->eq('changing')->where('status')->eq('draft')->andWhere('version')->gt(1)->exec();
/* Other stories in draft status should be 'reviewing'. */
$this->dao->update(TABLE_STORY)->set('status')->eq('reviewing')->where('status')->eq('draft')->exec();
/* The draft story with reviewers should be "reviewing". */
$reviewingStories = $this->dao->select('story')->from(TABLE_STORYREVIEW)->alias('t1')
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id and t1.version = t2.version')
->where('t2.status')->eq('draft')
->andWhere('t2.version')->eq(1)
->fetchPairs();
$this->dao->update(TABLE_STORY)->set('status')->eq('reviewing')->where('id')->in($reviewingStories)->exec();
return !dao::isError();
}