Skip to content

Commit aa34669

Browse files
committed
deduplicate over (domain, org, id), not just over id
WARNING: This change requires to alter your database index. Mysql: ALTER TABLE report DROP INDEX domain, ADD UNIQUE KEY domain (domain, org, reportid);
1 parent 51ba1de commit aa34669

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

dbx_Pg.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
additional_definitions => "PRIMARY KEY (serial)",
3030
table_options => "",
3131
indexes => [
32-
"CREATE UNIQUE INDEX report_uidx_domain ON report (domain, reportid);"
32+
"CREATE UNIQUE INDEX report_uidx_domain ON report (domain, org, reportid);"
3333
],
3434
},
3535
"rptrecord" => {

dbx_mysql.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"policy_pct" , "tinyint" , "unsigned",
2727
"raw_xml" , "mediumtext" , "",
2828
],
29-
additional_definitions => "PRIMARY KEY (serial), UNIQUE KEY domain (domain, reportid)",
29+
additional_definitions => "PRIMARY KEY (serial), UNIQUE KEY domain (domain, org, reportid)",
3030
table_options => "ROW_FORMAT=COMPRESSED",
3131
indexes => [],
3232
},

dmarcts-report-parser.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -813,8 +813,8 @@ sub storeXMLInDatabase {
813813
}
814814

815815
# see if already stored
816-
my $sth = $dbh->prepare(qq{SELECT org, serial FROM report WHERE reportid=?});
817-
$sth->execute($id);
816+
my $sth = $dbh->prepare(qq{SELECT org, serial FROM report WHERE reportid=? AND org=? AND domain=?});
817+
$sth->execute($id, $org, $domain);
818818
while ( my ($xorg,$sid) = $sth->fetchrow_array() )
819819
{
820820
if ($reports_replace) {

0 commit comments

Comments
 (0)