Several
customers have requested the ability to have recurring dates on
MyCalendar. This feature has now been added in the next version but I
want to make sure existing customers understand how this update will
effect them and their current installation. Here are some details
about the changes.
The
Database Tables Have Changed
The Events table has some addidtions:
id -
Unique identifier for an event
name -
Your event title
is_published -
Marks events as published or not
user_id -
Tracks the creator of the event
date -
Date that recurrences are calculated from
time -
Time your event starts and initial recurrences are start at.
text -
Details of your event
link -
An optional link for an event with details stored outside your site
or on another page.
length -
How long will this event be ( End time is calculated using this )
(
new)
pattern -
Recurrence rule string used to calculate the event recurrences.
(
new)
category -
Categories used for this event.
A
new
Occurrences table
will store:
id -
Unique identifier for an event
event_id -
Indicates which event this recurrence is for
relation -
Indicates what model this recurrence is for
reserved
for future
relation_id -
Indicates what id in another model this recurrence is for
reserved
for future
start_at -
Date and Time occurrence starts
end_at -
Date and Time occurrence ends
is_modified -
Indicates if occurrence has been modified since it's original
creation
is_allday -
Will indicate that this is an all day event without a specific time
is_canceled -
Will indicate that this occurrence was canceled
How
it works
Each
event you create will have primary information held in the
“events” table. While editing your event in the front end
form, you will have the option to preview your content and
recurrence choices. Once you save the event, the system will
generate the recurrence dates and store each recurrence in the "occurrences" table.
Each time you edit the event, the recurrences are recalculated and
existing records in the “occurrences” table are either shifted (
if the time or date changed ), created ( if there are more recurrence
records ), or marked as deleted ( if there are less recurrence
records ). Any “occurrences“ records that are changed will also
have an “is_modified” column marked as true as well.
This
model and occurrence relation was chosen to try preserve occurrence “id”s and ensure that
any relationships to these
occurrences
retains a valid reference. Any related model that is sensitive to a
date or time change in the occurrence can check the “is_modified”
column to make decisions about changes. There are also plans to
generate a
simple observer implementation when
event records are modified to allow
you to subscribe to
and
listen for events in your own
application.
When it is time to retrieve and display events from the database, the "occurrences
Recommendations
for Upgrading Existing Installations
Please
read if you are one of those fine folks that already have MyCalendar
installed and are using it on their website.
Back-up
your data before you do the install. ( This is one of those things
you hear all the time but you really can not go wrong here. )
If
you have a way to test the upgrade on a non-production site, do it
first to make sure you get the results you expect.
Clean-up
existing events that have the same content copied multiple times to
mimic recurring dates. You only need one remaining record from which recurrences will be calculated.
After
the update you will return and edit the one remaining event so
that it will show up as a recurring event.
Add a length for the event (up to 23:59 hours) ( This is how the end time is calculated. )
I found this easier and faster to do using phpMyAdmin where I can select multiple records and delete the extras.( I will work on making my backend lists and forms more efficient in the future. )
DO NOT set recurrence in backend form unless you know the RRULE string.