I’m seeking advice on the best method to implement a many-to-many relationship in Bubble. Specifically, I am considering two approaches:
- Creating a Junction Table.
- Relating two tables by creating a Data Type field and declaring that “This field is a list”.
The relationship details are as follows:
Organic_Certification: Valid for one year, includes several farmers.
- Farmers: Can have only one Organic_Certification at a time but accumulate several over the years.
Which of these approaches is more suitable for efficiently managing this kind of relationship in Bubble?
I would like to be able to present a table in the farmer’s profile with the history of all Organic_Certification they have belonged to.
Hi there, @PedroMartinto… because a farmer only accumulates several organic certifications over the years, a junction table seems to me like it could be overkill (assuming there is no meta data that needs to be stored for each farmer/organic certification combination), and I would likely go with a list of organic certifications on the farmer data type (or even a list of farmers on the organic certification data type, assuming that list would also be small).
Hope this helps.
I would create a data type called Certification and have a field for Farmer (or User). You then can add other fields for details about the certification like expiry date etc. that would be helpful, plus when you want to present the table to the farmer you simply need to
do a search for certifications with constraint of farmer = current farmer (again or user).
Or, have a list field on the farmer data type for certifications as it would be expected the list would never exceed 50 items so would remain pretty quick to retrieve.