I am trying to achieve the below database structure.
3 tables:
Post
columns: various fields, unique_id
Tag
columns: Name, unique_id
PostTag
columns: post_unique_id, tag_unique_id
In my UI, I have a multi line input for the post, a multi input dropdown which fetches values dynamically from the Tag table.
Now when I click the “Post” button to post it, I want an entry in the post table which saves the new unique_id. The Tag table already has all the entries required, I am not writing to it from the input box, just fetching right now.
The PostTag table should store values for each tag entered. For example if the post has 3 tags, I should get 3 different rows with the same post_unique_id, and the separate tag_unique_id.
I did it by tag list by inside posts and that worked. for my use case. Thanks for the suggestion. However, I am wondering if that is a good database design. Posts by items in 3 rows I think would scale well.
I’m a little confused at what you’re trying to accomplish but I think it’s just because you’re new with the bubble architecture?
Each row of data that is created automatically has a “unique id” so there is no need to create that field again.
From your description, it appears that you only need a Post data type and a Tag data type. In the Post data type should be a field of type Tag that is set as a list.
Then for each Post, you’ll get a list of the Tags associated with that post (in your database, the list will show the unique IDs of each Tag separated by a comma).