I want to have a simple database table to keep track of scheduled category visibility on a site index. Basically it will tell the index to display a Christmas category between Thanksgiving and Christmas day.
So far I'm thinking of using a table like this,
schedule_id SMALLINT,
start_date TIMESTAMP,
end_date TIMESTAMP,
category_id SMALLINT,
annual BOOL
Simple enough, the database can select any rows where the time falls between start/end.
My issue comes in with my annual flag. Basically I'm thinking that once a day the database can update the table, and add one year to any row where end_date < now and annual is true, otherwise delete the row if it's expired.
I'm worried that leap years or something could offset the rescheduled date.
Am I on the right track here ?
Is there a better way to do this ?