From 5321151f7ebb6b2740b91cbbd916b251ce9d30f3 Mon Sep 17 00:00:00 2001 From: "Enot (ded) Skelly" Date: Tue, 26 May 2026 10:53:49 -0700 Subject: [PATCH] fix hash only channel issue the db was adding rows for any observation of a hash without a known key --- db/migrations/001_schema.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/db/migrations/001_schema.sql b/db/migrations/001_schema.sql index c78c5af..714120d 100644 --- a/db/migrations/001_schema.sql +++ b/db/migrations/001_schema.sql @@ -275,6 +275,10 @@ CREATE TABLE channels ( UNIQUE (channel_hash, key_fingerprint) ); +CREATE UNIQUE INDEX idx_channels_hash_no_key +ON channels (channel_hash) +WHERE key_fingerprint IS NULL; + CREATE INDEX idx_channels_last_seen ON channels(last_seen DESC); CREATE INDEX idx_channels_hash ON channels(channel_hash); CREATE INDEX idx_channels_hashtag ON channels(hashtag) WHERE hashtag IS NOT NULL;