Currently, the ChannelMembers collection/model allows duplicate records with the same channelId and memberId. This creates issues such as duplicate operator entries, inconsistent queries, and unnecessary memory usage.
The goal of this issue is to add a compound unique index at the database/schema level to guarantee that each member can only exist once per channel. Additionally, we need a cleanup/migration script to detect and remove existing duplicates, ensuring data consistency going forward.
Currently, the ChannelMembers collection/model allows duplicate records with the same channelId and memberId. This creates issues such as duplicate operator entries, inconsistent queries, and unnecessary memory usage.
The goal of this issue is to add a compound unique index at the database/schema level to guarantee that each member can only exist once per channel. Additionally, we need a cleanup/migration script to detect and remove existing duplicates, ensuring data consistency going forward.