# Database Structure — should I go three levels deep? Would love your input!

**URL:** <https://community.glideapps.com/t/database-structure-should-i-go-three-levels-deep-would-love-your-input/76718>\
**Category:** Ask for Help\
**Created:** [September 30, 2024, 10:12pm UTC](https://community.glideapps.com/t/database-structure-should-i-go-three-levels-deep-would-love-your-input/76718 "2024-09-30T22:12:04Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [September 30, 2024, 10:12pm UTC](https://community.glideapps.com/t/database-structure-should-i-go-three-levels-deep-would-love-your-input/76718/1 "2024-09-30T22:12:04Z")

</div>

Trying to think this through. If you’re a database wiz by trade, would love your input! Many thanks!  
https://www.loom.com/embed/a5a0785fa89b443faab41034dd872320

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [October 1, 2024, 12:34am UTC](https://community.glideapps.com/t/database-structure-should-i-go-three-levels-deep-would-love-your-input/76718/2 "2024-10-01T00:34:07Z")

</div>

So the dilemmas in your structures come down to these questions.

**1/Should blocked-off times be included in the assignments table or have a separate table?**

For blocked-off times, there might be some further considerations here. If it’s a blocked-off period unrelated to any mobilizations, does it complicate your structure? I guess you can just do some queries to filter them out and it might not be a big issue at all. My take on this is you can do it in the same table.

**2/Is it suitable to keep clock-in and clock-out times in the same table as assignments?**

Same as above, I think you can keep it here, unless they said people can clock in and clock out multiple times per assignment.

**3/Is a separate table for mobilization days necessary?**

It could be beneficial, seeing you say that operations lead want to view and manage those assignments day by day. I guess you have to use a series of action here every time the schedule is changed. Say check the start and end date, generate a list of days to be “added”. Check if they are “added” already, if not, add a new row.

Can be complicated when they span across weeks and you need to take into account days when they don’t work, plus the specific start/end times within each day?

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [October 1, 2024, 1:29am UTC](https://community.glideapps.com/t/database-structure-should-i-go-three-levels-deep-would-love-your-input/76718/3 "2024-10-01T01:29:13Z")

</div>

> [@ThinhDinh](#):
>
> My take on this is you can do it in the same table.

Unless I want to keep this data clean? I’m thinking maybe a separate table in case the blocked off time spans multiple days.

> [@ThinhDinh](#):
>
> unless they said people can clock in and clock out multiple times per assignment.

Yeah…I’ll need to get clarification here

> [@ThinhDinh](#):
>
> Can be complicated when they span across weeks and you need to take into account days when they don’t work

Hm…true. Maybe that would just be a different mobilization then? eg. 16-day job no weekends would be separate mobilizations that don’t include saturdays and sundays?

---

<div class="post-metadata">

**Author:** ![tuzin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/tuzin/32/86077_2.png) [@tuzin](https://community.glideapps.com/u/tuzin)\
**Post date:** [October 1, 2024, 4:24am UTC](https://community.glideapps.com/t/database-structure-should-i-go-three-levels-deep-would-love-your-input/76718/4 "2024-10-01T04:24:02Z")

</div>

The choice of the data source seems really important here. Are you planning on using GBT for this? I would look into having calculated JSON of days in mobilization rows

---

<div class="post-metadata">

**Author:** ![Sekayi\_Liburd](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/sekayi_liburd/32/77608_2.png) [@Sekayi\_Liburd](https://community.glideapps.com/u/Sekayi_Liburd)\
**Post date:** [October 1, 2024, 4:55am UTC](https://community.glideapps.com/t/database-structure-should-i-go-three-levels-deep-would-love-your-input/76718/5 "2024-10-01T04:55:55Z")

</div>

Hmm…Can the people switch between assignments? Also, is mobilization flexible in terms of start/end or persons assigned?

I’d keep the job and mobilization tables as simple as possible and consider whether it still works well if any of the other variables change. Maybe have the user input the gross number of days for the job and number of days for each mobilization (rather than a fixed start and end date).

As for the rest, my hunch is that separating the employee data into a timesheet table and another table for assignments might be a safer bet than doing too much on one table. I’m just thinking that in the event that an employee picks up multiple assignments in one day, it might be hard to deal with on a single table.

Finally, creating a calendar/planner for predicted or actual date-time input that displays the records visually → highest level is job, then mobilization and the detailed level is employee(s) assigned on the day.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/e/be6c2a69ab1eafb6892f7a6a37b31277c855c22d.png)

I still struggle with my data but hopefully I was able to help a little.

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [October 1, 2024, 1:20pm UTC](https://community.glideapps.com/t/database-structure-should-i-go-three-levels-deep-would-love-your-input/76718/6 "2024-10-01T13:20:04Z")

</div>

Hey Bob, I’ll answer the question at the end of your video:

“What would you do if this were your project?”

1. I’d considering calling _you_ for help 😅
2. I’d turn to your YouTube channel to see if you had videos that might help.
3. I’d turn to the community forum and use advanced search.
4. I might turn to the expert Slack channel though I tend to avoid it for help.
5. I might message directly a few experts I’m in touch with on occasion.
6. I’d ask AI to see what it would have to say.

A cocktail of the above.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [October 1, 2024, 1:33pm UTC](https://community.glideapps.com/t/database-structure-should-i-go-three-levels-deep-would-love-your-input/76718/7 "2024-10-01T13:33:17Z")

</div>

> [@Robert\_Petitto](#):
>
> Unless I want to keep this data clean? I’m thinking maybe a separate table in case the blocked off time spans multiple days.

When the blocking time spans multiple days, maybe yeah, moving it to another table would suit better. How would you integrate the blocking part when doing the assignment? Sounds like it would be the same problem like the “hotel booking” apps.

> [@Robert\_Petitto](#):
>
> Maybe that would just be a different mobilization then? eg. 16-day job no weekends would be separate mobilizations that don’t include saturdays and sundays?

Yeah, breaking them into ones that don’t cross Saturdays and Sundays would make them easier to manage, plus public holidays as well.

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [October 1, 2024, 1:43pm UTC](https://community.glideapps.com/t/database-structure-should-i-go-three-levels-deep-would-love-your-input/76718/8 "2024-10-01T13:43:21Z")

</div>

> [@tuzin](#):
>
> Are you planning on using GBT for this

That’s what I was planning, yes. Everything is a GBT except for Employee table.

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [October 1, 2024, 1:45pm UTC](https://community.glideapps.com/t/database-structure-should-i-go-three-levels-deep-would-love-your-input/76718/9 "2024-10-01T13:45:05Z")

</div>

> [@Sekayi\_Liburd](#):
>
> separating the employee data into a timesheet table and another table for assignments might be a safer bet

Agreed. Especially if it’s a long day that needs to be broken up into multiple shifts per day (eg. clocking out for lunch).

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [October 1, 2024, 1:48pm UTC](https://community.glideapps.com/t/database-structure-should-i-go-three-levels-deep-would-love-your-input/76718/10 "2024-10-01T13:48:43Z")

</div>

> [@ThinhDinh](#):
>
> How would you integrate the blocking part when doing the assignment?

When the operations manager goes to assign crew to the selected day, we’ll grab the date context and bring it into the employees table. From there we can run a query in the employees table that checks if any of those employees blocked themselves off for that date context and filter them out of whatever component I end up using to select the employees for that date.
