diff --git a/keyserver/src/database/migration-config.js b/keyserver/src/database/migration-config.js --- a/keyserver/src/database/migration-config.js +++ b/keyserver/src/database/migration-config.js @@ -490,6 +490,15 @@ `, ), ], + [ + 42, + async () => { + await dbQuery(SQL` + ALTER TABLE roles + ADD UNIQUE KEY thread_name (thread, name); + `); + }, + ], ]); const newDatabaseVersion: number = Math.max(...migrations.keys()); diff --git a/keyserver/src/database/setup-db.js b/keyserver/src/database/setup-db.js --- a/keyserver/src/database/setup-db.js +++ b/keyserver/src/database/setup-db.js @@ -340,7 +340,8 @@ ALTER TABLE roles ADD PRIMARY KEY (id), - ADD KEY thread (thread); + ADD KEY thread (thread), + ADD UNIQUE KEY thread_name (thread, name); ALTER TABLE sessions ADD PRIMARY KEY (id),