A community based topic aggregation platform built on atproto

fix(db): remove redundant index and add missing record_uri index

Database optimization changes:

1. Removed redundant idx_blocks_user_community index:
- UNIQUE constraint on (user_did, community_did) already creates
an index automatically
- Maintaining duplicate index wastes storage and degrades write
performance (every insert updates two identical indexes)

2. Added missing idx_blocks_record_uri index:
- Required for GetBlockByURI() queries used in Jetstream DELETE
operations
- Without this index, DELETE event processing does full table scan

Migration now has optimal indexes without redundancy.

Addresses: Critical review comments #1 and #7

+3 -2
+3 -2
internal/db/migrations/009_create_community_blocks_table.sql
··· 14 14 ); 15 15 16 16 -- Indexes for efficient queries 17 + -- Note: UNIQUE constraint on (user_did, community_did) already creates an index for those columns 17 18 CREATE INDEX idx_blocks_user ON community_blocks(user_did); 18 19 CREATE INDEX idx_blocks_community ON community_blocks(community_did); 19 - CREATE INDEX idx_blocks_user_community ON community_blocks(user_did, community_did); 20 + CREATE INDEX idx_blocks_record_uri ON community_blocks(record_uri); -- For GetBlockByURI (Jetstream DELETE operations) 20 21 CREATE INDEX idx_blocks_blocked_at ON community_blocks(blocked_at); 21 22 22 23 -- +goose Down 23 24 DROP INDEX IF EXISTS idx_blocks_blocked_at; 24 - DROP INDEX IF EXISTS idx_blocks_user_community; 25 + DROP INDEX IF EXISTS idx_blocks_record_uri; 25 26 DROP INDEX IF EXISTS idx_blocks_community; 26 27 DROP INDEX IF EXISTS idx_blocks_user; 27 28 DROP TABLE IF EXISTS community_blocks;