diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2020-10-14 15:24:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-14 15:24:43 +0100 |
commit | 8d9ecb3996730ebf8eb75191f17bddb3f96332c8 (patch) | |
tree | a3274453c42ca72f728d66c4ce833f6e3917685d /roomserver | |
parent | 286dd408ae623b218f9c5a97d53f174c0ea19cc2 (diff) |
Ignore duplicate redaction entries (#1522)
Diffstat (limited to 'roomserver')
-rw-r--r-- | roomserver/storage/postgres/redactions_table.go | 3 | ||||
-rw-r--r-- | roomserver/storage/sqlite3/redactions_table.go | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/roomserver/storage/postgres/redactions_table.go b/roomserver/storage/postgres/redactions_table.go index 289e1320..42aba598 100644 --- a/roomserver/storage/postgres/redactions_table.go +++ b/roomserver/storage/postgres/redactions_table.go @@ -39,7 +39,8 @@ CREATE INDEX IF NOT EXISTS roomserver_redactions_redacts_event_id ON roomserver_ const insertRedactionSQL = "" + "INSERT INTO roomserver_redactions (redaction_event_id, redacts_event_id, validated)" + - " VALUES ($1, $2, $3)" + " VALUES ($1, $2, $3)" + + " ON CONFLICT DO NOTHING" const selectRedactionInfoByRedactionEventIDSQL = "" + "SELECT redaction_event_id, redacts_event_id, validated FROM roomserver_redactions" + diff --git a/roomserver/storage/sqlite3/redactions_table.go b/roomserver/storage/sqlite3/redactions_table.go index a2179357..e6471486 100644 --- a/roomserver/storage/sqlite3/redactions_table.go +++ b/roomserver/storage/sqlite3/redactions_table.go @@ -37,7 +37,7 @@ CREATE TABLE IF NOT EXISTS roomserver_redactions ( ` const insertRedactionSQL = "" + - "INSERT INTO roomserver_redactions (redaction_event_id, redacts_event_id, validated)" + + "INSERT OR IGNORE INTO roomserver_redactions (redaction_event_id, redacts_event_id, validated)" + " VALUES ($1, $2, $3)" const selectRedactionInfoByRedactionEventIDSQL = "" + |