# How to structure the database for different user types?

**URL:** <https://forum.bubble.io/t/how-to-structure-the-database-for-different-user-types/98503>\
**Category:** Database\
**Created:** [June 23, 2020, 2:07pm UTC](https://forum.bubble.io/t/how-to-structure-the-database-for-different-user-types/98503 "2020-06-23T14:07:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![marko](https://avatars.discourse-cdn.com/v4/letter/m/dbc845/32.png) [@marko](https://forum.bubble.io/u/marko)\
**Post date:** [June 23, 2020, 2:07pm UTC](https://forum.bubble.io/t/how-to-structure-the-database-for-different-user-types/98503/1 "2020-06-23T14:07:33Z")

</div>

Hi,

I’m just trying to understand how Bubble handles databases. It’s rather complicated. I’d appreciate any advice on structuring my database? What I want to achieve:

1- Create users via regular signup  
2- Let users select or if not existing create companies from a list.  
3- So a user is attached to a company and I should be able to see which company is linked to which user and vice versa. A company may have several users attached to it but one of the users should be the primary account owner to enter/modify company data.  
5- Each company should have the following attributes in addition to regular contact info etc.  
a) a category  
b) team size  
c) experience level  
d) experience field  
4) gallery of works  
6- The paid subscription plans will be based and varied according to companies’ attributes.

Can Bubble handle this workflow? How?

---

<div class="post-metadata">

**Author:** ![J805](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/j805/32/41267_2.png) [@J805](https://forum.bubble.io/u/J805)\
**Post date:** [June 23, 2020, 2:10pm UTC](https://forum.bubble.io/t/how-to-structure-the-database-for-different-user-types/98503/2 "2020-06-23T14:10:57Z")

</div>

Hey there 👋

Bubble can handle this. I do it all the time. I normally allow the first user to be the admin user and then let them invite the other users to their company. Then they don’t get random people joining their company.

Each new user they invite, you can just attach the company they have created to that new user.

Does that make sense?

> **Click here to learn more**
>
> [www.nocodeminute.com](http://www.nocodeminute.com)
> 
> ![Presenting](https://us1.discourse-cdn.com/bubble/original/3X/6/5/65f6fab3efed1c82ed9ceb6b067f755e0766996c.gif)

Hope that helps! 😊

---

<div class="post-metadata">

**Author:** ![marko](https://avatars.discourse-cdn.com/v4/letter/m/dbc845/32.png) [@marko](https://forum.bubble.io/u/marko)\
**Post date:** [June 23, 2020, 2:22pm UTC](https://forum.bubble.io/t/how-to-structure-the-database-for-different-user-types/98503/3 "2020-06-23T14:22:48Z")

</div>

Hi J805,

Makes sense, thanks a lot. Now I have to find how I can create the admin user feature.

How should I structure the conditions in this directory? Users of the companies with certain company attributes should able to access to certain features. Since the companies will be the actual members of the subscription plans, not users, I’m having difficulty to make relations between these two major types. So the users will signup but their access to certain features will depend on the profile of their companies. Rather complicated for a Bubble beginner like me.

---

<div class="post-metadata">

**Author:** ![J805](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/j805/32/41267_2.png) [@J805](https://forum.bubble.io/u/J805)\
**Post date:** [June 23, 2020, 2:43pm UTC](https://forum.bubble.io/t/how-to-structure-the-database-for-different-user-types/98503/4 "2020-06-23T14:43:26Z")

</div>

No problem.

What I normally do is make a Company data type.

For example:

**Company**  
userList (type User LIST)  
companyName (type ‘text’)  
etc…

**User**  
parentCompany (type Company)  
nameFirst (type ‘text’)  
nameLast (type ‘text’)  
userType (type ‘text’ i.e. = admin, employee, manager, etc)  
etc…

Then when checking on a subscription you can give access if anyone in the company list has a subscription that is active.

Also you can allow privacy roles to any user that is in the company as well.

Hope that helps 😊

---

<div class="post-metadata">

**Author:** ![marko](https://avatars.discourse-cdn.com/v4/letter/m/dbc845/32.png) [@marko](https://forum.bubble.io/u/marko)\
**Post date:** [June 23, 2020, 3:28pm UTC](https://forum.bubble.io/t/how-to-structure-the-database-for-different-user-types/98503/5 "2020-06-23T15:28:43Z")

</div>

I see. Thank you very much J805, I’ll start with this.

I think I also need to have a “access level” type for the companies so that I can adjust access to different sections of the site by filtering this type and blocking some parts of the site.

---

<div class="post-metadata">

**Author:** ![J805](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/j805/32/41267_2.png) [@J805](https://forum.bubble.io/u/J805)\
**Post date:** [June 23, 2020, 3:40pm UTC](https://forum.bubble.io/t/how-to-structure-the-database-for-different-user-types/98503/6 "2020-06-23T15:40:30Z")

</div>

Good idea, just add a type field to the Company data type and limit access by that. 🙂

Let us know if you get stuck and we will see what we can do. 😊
