diff --git a/keyserver/src/creators/thread-creator.js b/keyserver/src/creators/thread-creator.js --- a/keyserver/src/creators/thread-creator.js +++ b/keyserver/src/creators/thread-creator.js @@ -482,6 +482,15 @@ updatesForCurrentSession, ); + if (threadTypeIsCommunityRoot(threadType)) { + const query = SQL` + INSERT INTO communities (id) + VALUES (${id}) + `; + + await dbQuery(query); + } + return { newThreadID: id, updatesResult: { diff --git a/keyserver/src/deleters/thread-deleters.js b/keyserver/src/deleters/thread-deleters.js --- a/keyserver/src/deleters/thread-deleters.js +++ b/keyserver/src/deleters/thread-deleters.js @@ -95,6 +95,7 @@ const deletionQuery = SQL` START TRANSACTION; DELETE FROM threads WHERE id IN (${threadIDs}); + DELETE FROM communities WHERE id IN (${threadIDs}); DELETE FROM ids WHERE id IN (${threadIDs}); DELETE d, id, e, ie, r, ir FROM days d