+ 2

What is best way to store repeatable task(daily,weekly) in a database?

21st Oct 2018, 5:26 PM
DEVANANDU P
DEVANANDU P - avatar
7 ответов
+ 3
Are you looking for table structure ideas? this be what I have in mind; [Tasks] Task_Id (primary) Task_class (daily, weekly ...) Task_description [Tasks_details] Task_Id (refer to Tasks.Task_Id) Task_start (date/time of task initialization) Task_complete (date/time of task completion) Task_status (task status: success, failure, pending ...) Task_next (next date/time to execute task) Sorry if you meant something else.
24th Oct 2018, 7:41 AM
Ipang
+ 3
The value of <Schedule_Data> for daily and weekly schedules type are sort of bitwise flags, you can add or remove day flag from it or compound some days flag together. For example, if a schedule was to be executed on Monday, Wednesday and Friday the value would be 1 + 4 + 16. But if you prefer it in another way, you can look into SET or ENUM field types. https://dev.mysql.com/doc/refman/5.7/en/set.html https://dev.mysql.com/doc/refman/5.7/en/enum.html
26th Oct 2018, 6:34 AM
Ipang
+ 2
thanks for writing... yeah I am looking for table structure... but how can I search for all my tasks given a time range?
24th Oct 2018, 7:45 AM
DEVANANDU P
DEVANANDU P - avatar
+ 2
Do you mean a single task can be delegated to multiple assignee? in that case I guess we need to have a table for assignee data, and use the Assignee table primary key as foreign key in Tasks_details table, not too sure though, I can't figure what relation is built between [Tasks] and [Asignee].
24th Oct 2018, 8:01 AM
Ipang
+ 2
[Schedules] Schedule_Id, Schedule_Description, Schedule_Type (1:Daily, 2:Weekly,3:Monthly) Schedule_Data (explanation follows) <Schedule_Data> defines when a task/event is to be executed. The meaning of this value depends on <Schedule_Type>, with the following scheme: * Schedule_Type = 1 (Daily) <Schedule_Data> value defines on which day(s) the task is executed. Possible values are: 1. Monday 2. Tuesday 4. Wednesday 8. Thursday 16. Friday 32. Saturday 64. Sunday * Schedule_Type = 2 (Weekly) <Schedule_Data> value defines on which day(s) of the week the task is executed. Possible values are: 1. Monday 2. Tuesday 4. Wednesday 8. Thursday 16. Friday 32. Saturday 64. Sunday *,Schedule_Type = 3 (Monthly) <Schedule_Data> value defines date on the month the task is to be executed. Possible values are from 1 to 31, depends on how many days in a month. If month is only 28 days and value is larger than 28, the task should be skipped. * Task A is weekly scheduled * Event B is monthly scheduled
26th Oct 2018, 6:02 AM
Ipang
+ 1
there is table storing tasks for example one entry could be repeat task A on Wednesday on every week..or repeat event b on 2nd of every month.. how should I store these details?
25th Oct 2018, 7:37 PM
DEVANANDU P
DEVANANDU P - avatar
+ 1
Thanks for the replies guyz..
9th Dec 2018, 6:12 PM
DEVANANDU P
DEVANANDU P - avatar