I am stuck with a problem. In an app's db, I am having a schedule
table which will store user provided schedules. E.g
- Daily
- Every Week
- Twice a Week
- Every 3rd (or any user chosen) day of week
- Every Month
- Twice a month
- Every x day of month
- Every x month of year
And so on. These schedules will then provide reference point to schedule different tasks or identify their repeat-ance.
I am not able to think of a proper database structure for it. The best I can get is to have a table with following columns:
- Day
- Week
- Month
- Year
- type
Then store the specified schedule in the related column and provide the type. e.g Every week can go like 1 in week column and 1 (designated value for repeating whole) or something like that.
The problem with this approach is that this table is gonna be used very frequently and the data retrieved will not be straightforward. It will need calculation to know the schedule type and hence will require complex db queries to get each type of schedule.
I am implementing it in Laravel app if that can provide any other methodology. It's a SAAS app with huge amount of data related to the schedule table.
Any help will be very much appreciated. Thanks