How can i structure this datebase the best?

Im building an app kind of like a marketplace in a way.
i have the following data types set up as follows right now:

User

  • Cart
  • Adress
  • First name
  • Last name
  • Favorites
  • Orders
  • Profilepic
  • Roles (Option set)
  • Profiles (= profiles)
  • Company (= company)
  • And all default Bubble stuff

Company:

  • CompanyName
  • CompanyRole
  • CompanySize
  • user (= user)

Profiles

  • Age
  • First name
  • Last name
  • Profilepic
  • Adress
  • Phone
  • user (= user)

Looking at it i feel like i have complicated things by having names in multiple data fileds etc? Reason why i not only have it in user is that i want to be able to display the names in repeating groups for the users with the “company” role.

Am i making this complicated? Can i just have the basic stuff like orders etc on users and store names and other vriables in companies and profiles?

Thankful for any help :slight_smile:

Bumping this thread

Hi Orbit,

Question: is there a scenario where you might have a person in your database, that doesn’t have a user account. i.e. an admin or hr person could enter them in.

Or is the person only created if they register?

If it’s the first, then (based on advice I’ve been. given in this forum) i’d have the 3 tables but probably just limit user to email and move all other fields to the profile. Then you could just do a search/filter on your repeating group where role = x.

If it’s the second scenario i’d probably only have the user and company table…

No, all users create accounts and get a role on creation (Option set = Company, Profile & staff). But only the roles Company and Profile has uniq data filed with the fields i provided above.

So it’s better to have names and images etc separate for Company and Profile and not store them in “user”?

Well based on that, and without seeing UI, you just need a User table and Company table