Database Design: Graphics, including Repetition

I need to develop an application that supports "schedules." Schedule example:

  • January 1, 2011 at 9:00
  • January 1, 2011 from 9:00 to 10:00
  • Every Monday at 9:00, from January 1, 2011.
  • Every Monday at 9:00, from January 1, 2011 to February 1, 2011.
  • Every Monday at 9:00, from January 1, 2011 for 10 occurrences
  • and etc.

If you've seen the Outlook Scheduler, this is basically what I need. Here is a screenshot of their interface: http://www.question-defense.com/wp-content/uploads/2009/04/outlook-meeting-recurrance-settings.gif

How do I model such information in a database? Keep in mind that I also need to request this, for example:

  • What are the planned events for today?
  • What are the next 10 dates / times for a specific periodic scheduled event?
  • Etc.

I use PHP / MySQL, but I am open to alternative solutions. Suggestions?

+5
source share
1 answer

My personal opinion is to create all events separately, with a start and end date. Then create a unique identifier for the event (possibly the identifier of the event of the first that you created) and assign it to all the events (so that you know that they are somehow related).

Benefits:

  • easy to do (you just count when the event happens and create them all only once)
  • ( , , , - )
  • ( )
  • ( )

:

- -

:

  • id int ()
  • ref_id int ( id)
  • date_start
  • date_end date
  • title
  • .. ..
  • saved_recurrence

, 4 :

  • JSON ( , , ,..)
  • ref_id= 0 saved_recurrence= JSON id ( )
  • ref_id= id
  • ref_id (saved_recurrence )

8 (2 4 ), ref_id. , . , ref_id. 0, . , ref_id, .

+3

All Articles