Back

Explicit Many-To-Many between User and CommunicationChannel collections

  • 0
  • Databases
Francisco "Klogan" Barros
21 Sep, 2023, 23:52

Preamble: you may want to check the attached screenshot

Before Appwrite Cloud was moved to v1.4, I had 3 collections. The User, the CommunicationChannel and the CommunicationChannelToUser collection.

The CommunicationChannelToUser collection is an explicit many-to-many table, which also contains attributes. Attributes of the relation. Each row in CommunicationChannelToUser contained one userId and one communicationChannelId, each user and each communication channel could appear multiple times in this table. However the pair userId, communicationChannelId, needed to be unique.

How would this be represented with the new relations features? I don't seem to be able to create unique indexes on relationship attributes.

TL;DR
The user is requesting help with representing an explicit many-to-many relationship between the `User` and `CommunicationChannel` collections in Appwrite Cloud. They previously had a `CommunicationChannelToUser` collection that served this purpose, where each row contained a unique pair of `userId` and `communicationChannelId`. However, with the update to Appwrite Cloud v1.4, they are unable to create unique indexes on relationship attributes. Solution: As of now, it is not possible to create unique indexes on relationship attributes in Appwrite Cloud. The user is advised to consider alternative methods or feature requests to achieve the desired functionality.
Drake
5 Oct, 2023, 16:53

right...i don't think you can create a unique index on relationships at the moment..

Drake
5 Oct, 2023, 16:53

you should probably 👍🏼 this issue: https://github.com/appwrite/appwrite/issues/5400

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more