Skip to content

Commit 36a2935

Browse files
committed
installer: remove duplicate mail_forwarding prior to adding unique key
1 parent b6698e0 commit 36a2935

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

install/patches/upd_0094.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
if(!defined('INSTALLER_RUN')) die('Patch update file access violation.');
4+
5+
class upd_0094 extends installer_patch_update {
6+
7+
public function onBeforeSQL() {
8+
global $inst;
9+
10+
// Remove any duplicate mail_forwardings prior to adding unique key
11+
$inst->db->query("DELETE FROM mail_forwarding WHERE forwarding_id IN (SELECT forwarding_id FROM (SELECT forwarding_id, COUNT(source) AS source_count FROM mail_forwarding GROUP BY source HAVING source_count > 1) as t1)");
12+
}
13+
14+
}

0 commit comments

Comments
 (0)