Best way to structure my Database?

Hey there,

Ok. So I’m trying to optimise my DB in the best possible way before I move any further into my app, and was just wondering on the best method to take.

I have of course the User type which has fields such as -

  • First Name
  • Last Name
  • User Avatar
  • Twitter Profile
  • Dribbble Profile

I also want to add Languages Spoken, Skills (ie; UI Design, Logo Design etc…), and Tools Used (Sketch, Photoshop etc…)

Should Languages Spoken, Skills, Tools be in their own Data Type as I do want to have those elements searchable later (ie; Search for someone who uses Photoshop etc…)

What would be the correct way to structure things here? And if Skills was a Data Type would this then have a field which is a List of texts? How would I then cross-reference User Data Type with new Data Types?

Another reason I ask about structure, is that I’m using the Multi-dropdown plugin, and would like to style each individual item on the front end (ie; Sketch, Photoshop) with a different background Color. When I had Tools as a list inside my User Data Type I could not target each individual item, only the whole list.

But then part of me thinks if I set up a Data Type called Skills, the only field that would go in there is Skill (ie; UI Design, Icon Design etc…) so wouldn’t that be a little redundant?

So confused!! :slight_smile:

Many thanks

User Data Type would be a List of Skills

Skill Data Type would have a single text field

1 Like

So in the User DT, a List of Skills called ‘Skills’, and the Skill DT, a single text field called ‘Skill’? Just trying to work out structure, and proper naming conventions?

Yes, that is right.

image

image

You can then really easily create dropdowns of all the skills by searching the Skill data type.

Don’t worry about naming conventions. List of Skills or My Skills or mySkills. All works the same, and whatever works best for YOUR understanding.

I like the “English” structure of Bubble’s query language, so if the more complex queries can read nicely then I think that helps a little.

1 Like

Hi Marc,

Nigel has rightly pointed out the ideal solution for structuring your DB :+1:.

As Nigel’s mentioned you’ll have a new data type for ‘Skills’ and then in that data type a single text field for the actual skill name. This way you can always expand upon later in time e.g. Years Experience set as a text field that can be populated by a dropdown of items for instance. What I’m trying to say is that it will give you more flexibility and freedom with that data type.

Then the new field created on the ‘User’ data type to with the field type ‘Skill’ referencing the new data type just created, of course this being a list as more than likely users will have more than one skill :wink:.

This is more complex, but alternatively you could have a data type with the skills pre-defined as static entries, then you could use a dropdown using dynamic data pulling from these entries and add to the list of things in a new data type on the user. The only benefit I see with this though is changing the static data would be more simple e.g. if a skill name changes you can update on the static content data type once rather than running a workflow query to update names…but I don’t think this is necessary in this scenario, just wanted to ramble :smile:

There is a good post here that refers to some examples and fundamentals, worth a read…

1 Like

Thanks Nigel. Makes things much clearer.

Thanks so much Luke. It’s all falling into place now :slight_smile:

A couple of issues I have though with this method currently. Firstly when I view my Users DB entry the Skills are just shown as ID’s…

And secondly when I choose the Dynamic Choices option for my Multi-Select Dropdown plugin I get the options spilling out of the container when in edit mode (if i use Static the container extends its height correctly, but not with Dynamic?)…

skills_container

Go into Data/App data/Primary fields and set skills to be name instead of unique id.

1 Like

Glad things are clearing up. So for the 1st point and as Nigel has answered this can be simply changed as its a reference to the field. Under Data > App Data
image
Then you can change the Skill from unique ID to the name.

For point 2 I’m not sure to be honest. You cannot dynamically set the height unfortunately e.g. when count > 5 adjust height - although this probably can be done with triggering CSS.
Back to the point, I think this could be classed as a bug with the plugin as it should stretch like a multi-line input when more items are added. Therefore could be worth a bug report.

1 Like

Thanks chaps for your invaluable advice.

With the height issue it’s really strange where it will conform with Static choices but not Dynamic??

The weird issue I have noticed Luke is that if click Edit your Profile the 1st time the container issue happens, but then when I click Save Updates, and then Edit your Profile the 2nd time the issue has resolved? I have a State on this page, could that be causing an issue?

com-optimize