From cfeb1b2f4281c9b9b420f9ed9166cd4d8e549288 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Thu, 23 Jul 2020 10:22:23 +0100 Subject: [PATCH] Add UNIQUE constraint to blacklist table (#1216) --- federationsender/storage/postgres/blacklist_table.go | 3 ++- federationsender/storage/sqlite3/blacklist_table.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/federationsender/storage/postgres/blacklist_table.go b/federationsender/storage/postgres/blacklist_table.go index f1db9fae..8de6feec 100644 --- a/federationsender/storage/postgres/blacklist_table.go +++ b/federationsender/storage/postgres/blacklist_table.go @@ -25,7 +25,8 @@ import ( const blacklistSchema = ` CREATE TABLE IF NOT EXISTS federationsender_blacklist ( -- The blacklisted server name - server_name TEXT NOT NULL + server_name TEXT NOT NULL, + UNIQUE (server_name) ); ` diff --git a/federationsender/storage/sqlite3/blacklist_table.go b/federationsender/storage/sqlite3/blacklist_table.go index 3e302906..a14fe0c4 100644 --- a/federationsender/storage/sqlite3/blacklist_table.go +++ b/federationsender/storage/sqlite3/blacklist_table.go @@ -25,7 +25,8 @@ import ( const blacklistSchema = ` CREATE TABLE IF NOT EXISTS federationsender_blacklist ( -- The blacklisted server name - server_name TEXT NOT NULL + server_name TEXT NOT NULL, + UNIQUE (server_name) ); `