Skip to content

Commit

Permalink
fixup! fix: duplicate uid repair job failing on postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
st3iny committed Jul 4, 2024
1 parent e613e0f commit d9aa74b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions lib/Db/MessageMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1672,7 +1672,7 @@ public function deleteDuplicateUids(): void {
$qb->expr()->eq('t1.uid', 't2.uid', IQueryBuilder::PARAM_INT),
$qb->expr()->neq('t1.id', 't2.id', IQueryBuilder::PARAM_INT),
))
->groupBy('t1.mailbox_id', 't1.uid')
->groupBy('t1.mailbox_id', 't1.uid', 't1.id')
->executeQuery();
$rows = $result->fetchAll();
$result->closeCursor();
Expand All @@ -1684,7 +1684,7 @@ public function deleteDuplicateUids(): void {
$deleteQb = $this->db->getQueryBuilder();
$deleteQb->delete($this->getTableName())
->where(
$deleteQb->expr()->neq(
$deleteQb->expr()->eq(
'id',
$deleteQb->createParameter('id'),
IQueryBuilder::PARAM_INT,
Expand Down Expand Up @@ -1718,13 +1718,10 @@ public function deleteDuplicateUids(): void {
$first = false;
continue;
}

$deleteQb->setParameter('id', $id, IQueryBuilder::PARAM_INT);
$deleteQb->setParameter('mailbox_id', $mailboxId, IQueryBuilder::PARAM_INT);
$deleteQb->setParameter('uid', $uid, IQueryBuilder::PARAM_INT);

//$deleteQb->setParameter('id', $row['id'], IQueryBuilder::PARAM_INT);
//$deleteQb->setParameter('mailbox_id', $row['mailbox_id'], IQueryBuilder::PARAM_INT);
//$deleteQb->setParameter('uid', $row['uid'], IQueryBuilder::PARAM_INT);
$deleteQb->executeStatement();
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/Db/MessageMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public function testDeleteDuplicateUids(): void {
$mailbox2 = new Mailbox();
$mailbox2->setId(2);
$mailbox3 = new Mailbox();
$mailbox3->setId(2);
$mailbox3->setId(3);
$this->insertMessage(100, 1);
$this->insertMessage(101, 1);
$this->insertMessage(101, 1);
Expand Down

0 comments on commit d9aa74b

Please sign in to comment.