3

I am researching on how to properly build a recurring event system, that will allow for "custom" data on each recurring event. Say I have an event that I have set to repeat every thursday. I then wish to allow users on each event to tell if they are participating in this specific event; invite users to a specific event on a recurring date; have a "wall of posts" on each recurring event date, etc. Or even, say that one of the recurring events will have a different end-time.

The best I have found so far, on creating recurring events is this: Calendar Recurring/Repeating Events - Best Storage Method - specfically this answer: https://stackoverflow.com/a/16659802/2118665

However, in all above examples, each event is stored and have the same "event_id" on each date. This makes it more or less impossible to store specific information on a event, say the third of the recurring events.

Community
  • 1
  • 1
FooBar
  • 5,752
  • 10
  • 44
  • 93

1 Answers1

0

The two tables from the example will work great for populating the calendar and handling the recurring events.

Events Table
ID    NAME
1     Sample Event
2     Another Event

Events Meta Table
ID    event_id      meta_key           meta_value     start_time     end_time
1     1             repeat_start       1299132000     5:00 pm        7:00 pm
2     1             repeat_interval_1  432000

I added start and end time to the table from the example.

What you need is another table to handle the participants for the specific days. I would use event_id and date_time as a composite key so that reusing the same event_id won't be an issue for you as that was one of your concerns.

Participants Table
event_id     date_time               user_id
1            2015-10-29 00:00:01     1
1            2015-10-29 00:00:01     2
1            2015-10-29 00:00:01     3

To override the meta table default values for the event you would add an entry to the event details table or whatever you want to name it and specify for a specific date the start and end times.

Event Details
event_id     date_time              start_time     end_time
1            2015-10-29 00:00:01    5:00 pm        7:30 pm

This should be a good start, you will have to refine it to be more specific for your needs.

Hatem Jaber
  • 2,341
  • 2
  • 22
  • 38