My app requires users to schedule recurring events that can recur daily, weekly, monthly, or bi-weekly.
By bi-weekly, I mean every fortnight (14 days) starting from an arbitrary date value provided at the time of creation.
My jobs
table has two columns to support this: job_frequency_id
and job_frequency_value
. I'm able to schedule all types except for bi-weekly.
The first col is an FK to the job_frequencies
table; it contains daily, weekly, monthy, bi-weekly
values. The job_frequency_value
contains the value corresponding to the frequency.
For example: If a job has a job_frquency_id == 3
and job_frequency_value == 10
, it will run every 10th day of the month.
How do I add bi-weekly support without tampering with my db structure? I will use the job_frequency_value
col to store the start date of the 14 day period, but I'm unsure of the calculation going forward.