@@ -132,24 +132,3 @@ |
||
| 132 | 132 | switch ($this->getConnection()->getDriver()->getDatabasePlatform()->getName()) { |
| 133 | 133 | case 'postgresql': |
| 134 | 134 | return sprintf(<<<'SQL' |
| 135 | -UPDATE %s SET comments_count = count_comment.total |
|
| 136 | -FROM (SELECT c.post_id, count(*) AS total FROM %s AS c WHERE c.status = 1 GROUP BY c.post_id) count_comment |
|
| 137 | -WHERE %s.id = count_comment.post_id |
|
| 138 | -SQL, |
|
| 139 | - $postTableName, |
|
| 140 | - $commentTableName, |
|
| 141 | - $postTableName |
|
| 142 | - ); |
|
| 143 | - |
|
| 144 | - default: |
|
| 145 | - return sprintf(<<<'SQL' |
|
| 146 | -UPDATE %s p, (SELECT c.post_id, count(*) as total FROM %s as c WHERE c.status = 1 GROUP BY c.post_id) as count_comment |
|
| 147 | -SET p.comments_count = count_comment.total |
|
| 148 | -WHERE p.id = count_comment.post_id |
|
| 149 | -SQL, |
|
| 150 | - $postTableName, |
|
| 151 | - $commentTableName |
|
| 152 | - ); |
|
| 153 | - } |
|
| 154 | - } |
|
| 155 | -} |
|