Hello Guys,
I've been working on an App for a little while which is going to require some form of scheduling of events into a database, but its one that doesn't quite meet the specification of any pre-built calendar applications available, so its been left to muggins here to start constructing somthing.
Basicly the events, as i see it, will fall into one of two catagories, they will iether be a 1 off event, with a start date and end date, or they will be a recursive event which will start on a particular date, end of a particular date but then be recursed daily, weekly or monthly.
Now i'm really struggling to conceptualize the storage method for these in the database, now the simple step would be to simple create a record in the database for every recurance of the event, when a user adds and event, the query simply loops and creates a record for every occurance for the next 12 months or somthing similar.
However, this is bound to lead to a very large and possibly unmanagable database, imagine an event that is scheduled to happen every day, you end up with 365 events all of which contain the same data, poor database design i'm sure you'll agree.
So my thoughts are that i should be placing some form of flagging system onto the records, so they contain a start date, and then another field that represents the recurance, iether it be 1, 7, 14, or whatever.
I would then need to be able to query the database for all events to occur in the next week, and then take those events and act on them with a mail or somthing.
I thought i'd ask your opinions and experience with building this kind of thing, how would you reccomed i build this section of the application?
I'm using MySQL 5 which i know has a whole stack of different date/time functions, however i'm reasonably inexperienced in using them.
Thanks guys,
Rob
I've been working on an App for a little while which is going to require some form of scheduling of events into a database, but its one that doesn't quite meet the specification of any pre-built calendar applications available, so its been left to muggins here to start constructing somthing.
Basicly the events, as i see it, will fall into one of two catagories, they will iether be a 1 off event, with a start date and end date, or they will be a recursive event which will start on a particular date, end of a particular date but then be recursed daily, weekly or monthly.
Now i'm really struggling to conceptualize the storage method for these in the database, now the simple step would be to simple create a record in the database for every recurance of the event, when a user adds and event, the query simply loops and creates a record for every occurance for the next 12 months or somthing similar.
However, this is bound to lead to a very large and possibly unmanagable database, imagine an event that is scheduled to happen every day, you end up with 365 events all of which contain the same data, poor database design i'm sure you'll agree.
So my thoughts are that i should be placing some form of flagging system onto the records, so they contain a start date, and then another field that represents the recurance, iether it be 1, 7, 14, or whatever.
I would then need to be able to query the database for all events to occur in the next week, and then take those events and act on them with a mail or somthing.
I thought i'd ask your opinions and experience with building this kind of thing, how would you reccomed i build this section of the application?
I'm using MySQL 5 which i know has a whole stack of different date/time functions, however i'm reasonably inexperienced in using them.
Thanks guys,
Rob