Skip to content

Enforce unique membership per channel in ChannelMembers model (channelId + memberId) #368

@enkhtuvshinD

Description

@enkhtuvshinD

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions