V
V
Verkan2021-07-03 15:20:20
Database design
Verkan, 2021-07-03 15:20:20

Schedule for the week by the hour, how to store?

Schedule
60e05401879ba239575766.png
An example of an array in code with a schedule.

[
    'mo' => [0,1,5,6,7],
    'sa' => [5,6,7],
    'fr' => [0,1,7],
]

Sample database implementation
60e05438bbf8f775321552.png

MariaDB server (middle).
The table data is updated only by the user, but there will be a lot of requests based on the schedule.

Will this implementation survive? Does it have problems? If there are other better implementations, please pin them. I will be grateful for help)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Sokolov, 2021-07-03
@Verkan

If it's just binary free/busy, you can store a whole day as a 24-bit mask, a single integer. Each bit means vacancy resp. hours.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question