WebCalendar Upgrading Notes

WebCalendar Version: 1.3.0

Important News: A major improvement beginning with Version 1.1 is the addition of an automated installation script. This script will guide you through the installation process and help identify any problem areas that might prevent successful installation or operation of WebCalendar.

This installation script was tested primarily using MySQL and Apache on a dedicated server. If using an ISP or a CPANEL installer, your mileage may vary. If problems arise, you can always follow the instruction below as in previous versions and setup your database manually. As with any upgrade, it's always a good idea to backup your data prior to installation.

Another major upgrade to WebCalendar for v1.1 is the implementation of full timezone support. In olders versions, all date/time data was stored based on server time and users set their 'time offset' relative to server time. Now, all date/time data will be stored in the database as Greenwich Mean Time (GMT) and users will be able to select a timezone based on their geographical location.

Having true timezone information available within WebCalendar enables the system to correct for Daylight Savings Time (DST) even if users are in different timezones. The database houses timezone information from 1970 to 2038 and can calculate the appropriate GMT offset required to allow users to see events in their true 'local time'.

The installation script will perform the initial import of the timezone data and guide you through the one-time conversion required to get your existing data converted to GMT.

Launch the Automatic Installation Script

Upgrading Steps

With the install wizard, you will no longer be troubled with uploading SQL files to phpMyAdmin or executing SQL commands yourself. (For the most part. There are one or two database types that have not been fully implemented, as yet. If you are able to set them up, we'd appreciate the help.) Your database will be upgraded automatically from your current WebCalendar installation. Follow the steps below to upgrade to WebCalendar 1.3.0 from an older version of WebCalendar.

NOTE: You should use the Launch the Automatic Installation Script instead of doing this manually, but the information below is provided as documentation for those who are interested... All users (including those using the Automatic Installation Script) should create a backup of their database before performing the upgrade.

  1. Make a backup of your current WebCalendar database. This can be done a couple of different ways.
  2. Make a backup of your current WebCalendar files on the server. You would typically do this with an FTP client (like FileZilla).
  3. Install the new WebCalendar files in a new directory on your server. How you do this will depend on what type of access you have to your server. It is best to not overwrite your old WebCalendar install. The unpacked/unzipped files will create a directory with the current WebCalendar version name in it.
  4. Optional: If you prefer to use a simple name (like "webcalendar" rather than "WebCalendar-1.2.7"), then you can rename the directory after you've installed the files. A good way to do this might be to rename your old webcalendar install to something like "webcalendar-oldinstall" and rename the new install to be the same name as your old one.
    Note: If you are planning on renaming the directory, it is best to do this before you proceed to the automated install.
  5. Change the permissions of the includes directory. If you are doing this from FTP, change directories to the new webcalendar directory and use the following command:
      chmod 777 includes
  6. Change the permissions of the icons directory. If you are doing this from FTP, change directories to the new webcalendar directory and use the following command:
      chmod 777 icons
  7. Download a copy of your old includes/settings.php file from your current WebCalendar install and have it handy so you can enter the same values in your upgrade process.
  8. Download all files in your old icons directory from your old WebCalendar and copy the files into the icons directory in the new install directory.
  9. You're now ready to start the install/upgrade wizard. Point your browser to the web server where you have installed the files. You only need to specify the webcalendar directory to get to the wizard. Since there is no includes/settings.php file in the new install, you will be redirected to the install/upgrade wizard.
  10. Once the wizard is complete, it's a good idea to change your includes permissions back to what they were originally for better security.

Manual Upgrade Instructions

Below are the steps needed to manually upgrade from a previous version. You can ignore everything below if you use the Automated Installation Script. Select the version of your existing install from the list below. If you are more than one version behind (i.e. the new version is v1.2.7, and you're using 1.1.1), you'll need to perform each upgrade in sequence from your current version on up. Don't skip any.

Note: Due to large number of database types that WebCalendar can support, it would be impractical to list all the SQL variations here. All SQL listed is taken from the upgrade-mysq.sql file used during the automatic installation process. If you are using a database other then MySQL, you may want refer to the appropriate upgrade-xxxxx.sql file in the install/sql folder.

My currently installed version is...


To upgrade from v0.9

You need to create the table cal_user_pref in tables.sql. You need to create the table cal_entry_user in tables.sql that was mistakenly created as "cal_event_user" in the 0.9 release.

next...

To upgrade from v0.9.01

Entirely new tables are used. Use the following commands to convert your existing MySQL tables to the new tables:

cd tools
./upgrade_to_0.9.7.pl
mysql intranet < commands.sql
    

where "intranet" is the name of the MySQL database that contains your WebCalendar tables.

next...

To upgrade from v0.9.07 - v0.9.11

To fix a bug in the handing of events at midnight, all the entries with NULL for cal_time are changed to -1. Use the following SQL command:

UPDATE webcal_entry SET cal_time = -1 WHERE cal_time is null;
next...

To upgrade from v0.9.12 or v0.9.13

A new table was added to support repeating events. Use the following SQL command:

CREATE TABLE webcal_entry_repeats (
  cal_id INT DEFAULT '0' NOT NULL,
  cal_days CHAR(7),
  cal_end INT,
  cal_frequency INT DEFAULT '1',
  cal_type VARCHAR(20),
  PRIMARY KEY (cal_id)
);
    
next...

To upgrade from v0.9.14 - v0.9.21

A new table was added to support layering. For MySQL, the SQL is:

CREATE TABLE webcal_user_layers (
  cal_login varchar(25) NOT NULL,
  cal_layeruser varchar(25) NOT NULL,
  cal_color varchar(25) NULL,
  cal_dups CHAR(1) DEFAULT 'N',
  cal_layerid INT DEFAULT '0' NOT NULL,
  PRIMARY KEY ( cal_login, cal_layeruser )
);
    
next...

To upgrade from v0.9.22 - v0.9.26

Two new tables were added for custom event fields and reminders. For MySQL the SQL is:

CREATE TABLE webcal_site_extras (
  cal_id INT DEFAULT '0' NOT NULL,
  cal_name VARCHAR(25) NOT NULL,
  cal_type INT NOT NULL,
  cal_date INT DEFAULT '0',
  cal_remind INT DEFAULT '0',
  cal_data TEXT,
  PRIMARY KEY ( cal_id, cal_name, cal_type )
);
CREATE TABLE webcal_reminder_log (
  cal_id INT DEFAULT '0' NOT NULL,
  cal_name VARCHAR(25) NOT NULL,
  cal_event_date INT NOT NULL DEFAULT 0,
  cal_last_sent INT NOT NULL DEFAULT 0,
  PRIMARY KEY ( cal_id, cal_name, cal_event_date )
);
    

You will also need to setup the tools/send_reminders.php script to be run periodically. I would recommend once an hour. For Linux/UNIX, this is simple. Just use cron and add a line to your crontab file that looks like:

1 * * * * cd /some/directory/webcalendar/tools; ./send_reminders.php

This will tell cron to run the script at one minute after the hour. Windows users will have to find another way to run the script. There are ports/look-a-likes of cron for Windows, so look around.

next...

To upgrade from v0.9.27 - v0.9.34

Six new tables were added for group support, views, system settings and activity logs. For MySQL the SQL is:

CREATE TABLE webcal_group (
  cal_group_id INT NOT NULL,
  cal_last_update INT NOT NULL,
  cal_name VARCHAR(50) NOT NULL,
  cal_owner VARCHAR(25) NULL,
  PRIMARY KEY ( cal_group_id )
);
CREATE TABLE webcal_group_user (
  cal_group_id INT NOT NULL,
  cal_login VARCHAR(25) NOT NULL,
  PRIMARY KEY ( cal_group_id, cal_login )
);
CREATE TABLE webcal_view (
  cal_view_id INT NOT NULL,
  cal_name VARCHAR(50) NOT NULL,
  cal_owner VARCHAR(25) NOT NULL,
  cal_view_type CHAR(1),
  PRIMARY KEY ( cal_view_id )
);
CREATE TABLE webcal_view_user (
  cal_view_id INT NOT NULL,
  cal_login VARCHAR(25) NOT NULL,
  PRIMARY KEY ( cal_view_id, cal_login )
);
CREATE TABLE webcal_config (
  cal_setting VARCHAR(50) NOT NULL,
  cal_value VARCHAR(50) NULL,
  PRIMARY KEY ( cal_setting )
);
CREATE TABLE webcal_entry_log (
  cal_log_id INT NOT NULL,
  cal_date INT NOT NULL,
  cal_entry_id INT NOT NULL,
  cal_login VARCHAR(25) NOT NULL,
  cal_time INT NULL,
  cal_type CHAR(1) NOT NULL,
  cal_text TEXT,
  PRIMARY KEY ( cal_log_id )
);
    
next...

To upgrade from v0.9.35 or v0.9.36

The webcal_entry_log table was modified, and a new table webcal_entry_repeats_not was created. Use the following SQL for MySQL:

ALTER TABLE webcal_entry_log ADD cal_user_cal VARCHAR(25);
CREATE TABLE webcal_entry_repeats_not (
  cal_id INT NOT NULL,
  cal_date INT NOT NULL,
  PRIMARY KEY ( cal_id, cal_date )
);
    
next...

To upgrade from v0.9.37

The webcal_entry_user table was modified, and a new table webcal_categories was created. Use the following SQL for MySQL:

ALTER TABLE webcal_entry_user ADD cal_category INT DEFAULT NULL;
CREATE TABLE webcal_categories (
  cat_id INT NOT NULL,
  cat_name VARCHAR(80) NOT NULL,
  cat_owner VARCHAR(25),
  PRIMARY KEY ( cat_id )
);
    
next...

To upgrade from v0.9.38

The names of the date settings in the database were modified. All old data settings need to be removed from the database.

DELETE FROM webcal_config WHERE cal_setting LIKE 'DATE_FORMAT%';
DELETE FROM webcal_user_pref WHERE cal_setting LIKE 'DATE_FORMAT%';
    
next...

To upgrade from v0.9.39

Two new tables were created: webcal_asst and webcal_entry_ext_user. And the column cal_ext_for_id was added to the webcal_entry table. Use the following SQL for MySQL:

CREATE TABLE webcal_asst (
  cal_boss VARCHAR(25) NOT NULL,
  cal_assistant VARCHAR(25) NOT NULL,
  PRIMARY KEY ( cal_boss, cal_assistant )
);
CREATE TABLE webcal_entry_ext_user (
  cal_id INT DEFAULT 0 NOT NULL,
  cal_fullname VARCHAR(50) NOT NULL,
  cal_email VARCHAR(75) NULL,
  PRIMARY KEY ( cal_id, cal_fullname )
);
ALTER TABLE webcal_entry ADD cal_ext_for_id INT NULL;
    
next...

To upgrade from v0.9.40

One new table was added: webcal_nonuser_cals. Use the following SQL for MySQL:

CREATE TABLE webcal_nonuser_cals (
  cal_login VARCHAR(25) NOT NULL,
  cal_admin VARCHAR(25) NOT NULL,
  cal_firstname VARCHAR(25),
  cal_lastname VARCHAR(25),
  PRIMARY KEY ( cal_login )
);
    
next...

To upgrade from v0.9.41

Three new tables were added: webcal_report, webcal_report_template, and webcal_import_data. Use the following SQL for MySQL:

CREATE TABLE webcal_report (
  cal_report_id INT NOT NULL,
  cal_allow_nav CHAR(1) DEFAULT 'Y',
  cal_cat_id INT NULL,
  cal_include_empty CHAR(1) DEFAULT 'N',
  cal_include_header CHAR(1) DEFAULT 'Y' NOT NULL,
  cal_is_global CHAR(1) DEFAULT 'N' NOT NULL,
  cal_login VARCHAR(25) NOT NULL,
  cal_report_name VARCHAR(50) NOT NULL,
  cal_report_type VARCHAR(20) NOT NULL,
  cal_show_in_trailer CHAR(1) DEFAULT 'N',
  cal_time_range INT NOT NULL,
  cal_update_date INT NOT NULL,
  cal_user VARCHAR(25) NULL,
  PRIMARY KEY ( cal_report_id )
);
CREATE TABLE webcal_report_template (
  cal_report_id INT NOT NULL,
  cal_template_type CHAR(1) NOT NULL,
  cal_template_text TEXT,
  PRIMARY KEY ( cal_report_id, cal_template_type )
);
CREATE TABLE webcal_import_data (
  cal_id int NOT NULL,
  cal_login VARCHAR(25) NOT NULL,
  cal_external_id VARCHAR(200) NULL,
  cal_import_type VARCHAR(15) NOT NULL,
  PRIMARY KEY  ( cal_id, cal_login )
);
    
next...

To upgrade from v0.9.42

User passwords are now stored using md5 and require the webcal_user table to be altered to accommodate larger password data. Use the following SQL for MySQL:

ALTER TABLE webcal_user MODIFY cal_passwd VARCHAR(32) NULL;
DROP TABLE webcal_import_data;
CREATE TABLE webcal_import (
  cal_import_id INT NOT NULL,
  cal_date INT NOT NULL,
  cal_login VARCHAR(25) NULL,
  cal_name VARCHAR(50) NULL,
  cal_type VARCHAR(10) NOT NULL,
  PRIMARY KEY ( cal_import_id )
);
CREATE TABLE webcal_import_data (
  cal_id INT NOT NULL,
  cal_login VARCHAR(25) NOT NULL,
  cal_external_id VARCHAR(200) NULL,
  cal_import_id INT NOT NULL,
  cal_import_type VARCHAR(15) NOT NULL,
  PRIMARY KEY  ( cal_id, cal_login )
);
    

Next, you will need to run the script found in the tools subdirectory. This will convert all your passwords from plain text to md5. You can run this from the command line (if you have a standalone version of PHP compiled):

cd tools
php convert_passwords.php
    

Or, if you do not have a standalone version of PHP, you can just type in the URL to access the script in your browser:

http://yourcalendarurl/tools/convert_passwords.php

You may safely delete the file /tools/convert_passwords.php after successfully performing this step.

Delete all webcalendar_login browser cookies. Details should be available on your local browser help section.

next...

To upgrade from v0.9.43 - v1.0RC3

The webcal_view table was modified. Execute the following SQL to update your database:

UPDATE webcal_config SET cal_value = 'week.php' WHERE cal_setting = 'STARTVIEW';
UPDATE webcal_user_pref SET cal_value = 'day.php'
  WHERE cal_value = 'day' AND cal_setting = 'STARTVIEW';
UPDATE webcal_user_pref SET cal_value = 'month.php'
  WHERE cal_value = 'month' AND cal_setting = 'STARTVIEW';
UPDATE webcal_user_pref SET cal_value = 'week.php'
  WHERE cal_value = 'week' AND cal_setting = 'STARTVIEW';
UPDATE webcal_user_pref SET cal_value = 'year.php'
  WHERE cal_value = 'year' AND cal_setting = 'STARTVIEW';
ALTER TABLE webcal_view ADD cal_is_global CHAR(1) NOT NULL DEFAULT 'N';
UPDATE webcal_view SET cal_is_global = 'N';
    
next...

To upgrade from v1.0RC3 - v1.0.0

Two new tables need to be created to support advanced user access control. One new table is needed to store custom user header/footer template information. Execute the following SQL to update your database:

CREATE TABLE webcal_access_user (
  cal_login VARCHAR(25) NOT NULL,
  cal_other_user VARCHAR(25) NOT NULL,
  cal_can_approve CHAR(1) NOT NULL DEFAULT 'N',
  cal_can_delete CHAR(1) NOT NULL DEFAULT 'N',
  cal_can_edit CHAR(1) NOT NULL DEFAULT 'N',
  cal_can_view CHAR(1) NOT NULL DEFAULT 'N',
  PRIMARY KEY ( cal_login, cal_other_user )
);
CREATE TABLE webcal_access_function (
  cal_login VARCHAR(25) NOT NULL,
  cal_permissions VARCHAR(64) NOT NULL,
  PRIMARY KEY ( cal_login )
);
ALTER TABLE webcal_nonuser_cals ADD cal_is_public CHAR(1) NOT NULL DEFAULT 'N';
CREATE TABLE webcal_user_template (
  cal_login VARCHAR(25) NOT NULL,
  cal_type CHAR(1) NOT NULL,
  cal_template_text TEXT,
  PRIMARY KEY ( cal_login, cal_type )
);
    
next...

To upgrade from 1.1.0-CVS or 1.1.0a-CVS

A new table is needed to support multiple categories. In addition, several new columns have been added to webcal_entry and one column added to webcal_entry_user to support VTODO tasks, and to webcal_repeats to support the much improved ical support. A new column was added to webcal_entry_repeats_not to differentiate between exclusion and inclusions. Use the following SQL to update your MySQL database:

ALTER TABLE webcal_entry ADD cal_due_date int(11) default NULL;
ALTER TABLE webcal_entry ADD cal_due_time int(11) default NULL;
ALTER TABLE webcal_entry ADD cal_location varchar(50) default NULL;
ALTER TABLE webcal_entry ADD cal_url varchar(100) default NULL;
ALTER TABLE webcal_entry ADD cal_completed int(11) default NULL;
ALTER TABLE webcal_entry_repeats ADD cal_endtime int(11) default NULL;
ALTER TABLE webcal_entry_repeats ADD cal_byday varchar(100) default NULL;
ALTER TABLE webcal_entry_repeats ADD cal_bymonth varchar(50) default NULL;
ALTER TABLE webcal_entry_repeats ADD cal_bymonthday varchar(100) default NULL;
ALTER TABLE webcal_entry_repeats ADD cal_bysetpos varchar(50) default NULL;
ALTER TABLE webcal_entry_repeats ADD cal_byweekno varchar(50) default NULL;
ALTER TABLE webcal_entry_repeats ADD cal_byyearday varchar(50) default NULL;
ALTER TABLE webcal_entry_repeats ADD cal_count int(11) default NULL;
ALTER TABLE webcal_entry_repeats ADD cal_wkst char(2) default 'MO';
ALTER TABLE webcal_entry_repeats_not ADD cal_exdate int(1) NOT NULL DEFAULT '1';
ALTER TABLE webcal_entry_user ADD cal_percent int(11) NOT NULL DEFAULT '0';
CREATE TABLE webcal_entry_categories (
  cal_id int(11) NOT NULL default '0',
  cat_id int(11) NOT NULL default '0',
  cat_order int(11) NOT NULL default '0',
  cat_owner varchar(25) default NULL
);
    
next...

To upgrade from 1.1.0b-CVS

We need a new table to handle event attachments and comments. This is the SQL.

CREATE TABLE webcal_blob (
  cal_blob_id INT NOT NULL,
  cal_description VARCHAR(128) NULL,
  cal_id INT NULL,
  cal_login VARCHAR(25) NULL,
  cal_mime_type VARCHAR(50) NULL,
  cal_mod_date INT NOT NULL,
  cal_mod_time INT NOT NULL,
  cal_name VARCHAR(30) NULL,
  cal_size INT NULL,
  cal_type CHAR(1) NOT NULL,
  cal_blob LONGBLOB,
  PRIMARY KEY (cal_blob_id)
);
    
next...

upgrading from 1.1.0cCVS

We're recreating table webcal_access_user to add several fields.

DROP TABLE IF EXISTS webcal_access_user;
CREATE TABLE webcal_access_user (
  cal_login VARCHAR(25) NOT NULL,
  cal_other_user VARCHAR(25) NOT NULL,
  cal_can_approve INT NOT NULL DEFAULT '0',
  cal_can_edit INT NOT NULL DEFAULT '0',
  cal_can_email CHAR(1) DEFAULT 'Y',
  cal_can_invite CHAR(1) DEFAULT 'Y',
  cal_can_view INT NOT NULL DEFAULT '0',
  cal_see_time_only CHAR(1) DEFAULT 'N',
  PRIMARY KEY (cal_login, cal_other_user)
);
    
next...

upgrading from 1.1.0d-CVS

A new table to track reminders. When are they due? Have they been sent?

CREATE TABLE webcal_reminders (
  cal_id INT NOT NULL DEFAULT '0',
  cal_action VARCHAR(12) NOT NULL DEFAULT 'EMAIL',
  cal_before CHAR(1) NOT NULL DEFAULT 'Y',
  cal_date INT NOT NULL DEFAULT '0',
  cal_duration INT NOT NULL DEFAULT '0',
  cal_last_sent INT NOT NULL DEFAULT '0',
  cal_offset INT NOT NULL DEFAULT '0',
  cal_related CHAR(1) NOT NULL DEFAULT 'S',
  cal_repeats INT NOT NULL DEFAULT '0',
  cal_times_sent INT NOT NULL DEFAULT '0',
  PRIMARY KEY (cal_id)
);
    
next...

Upgrade from 1.1.0e-CVS

A new field indicating the URL of a public, or at least a non-user, calendar event.

ALTER TABLE webcal_nonuser_cals ADD cal_url VARCHAR(255) DEFAULT NULL;
    
next...

Upgrade from 1.1.1

Add a color for each user category. We are also considering tracking more user data; birthday, phone, etc. As a contact reference as well as an event calendar.

ALTER TABLE webcal_categories ADD cat_color VARCHAR(8) DEFAULT NULL;
ALTER TABLE webcal_user ADD cal_address VARCHAR(75) DEFAULT NULL;
ALTER TABLE webcal_user ADD cal_birthday INT NULL;
ALTER TABLE webcal_user ADD cal_enabled CHAR(1) DEFAULT 'Y';
ALTER TABLE webcal_user ADD cal_last_login INT NULL;
ALTER TABLE webcal_user ADD cal_telephone VARCHAR(50) DEFAULT NULL;
ALTER TABLE webcal_user ADD cal_title VARCHAR(75) DEFAULT NULL;
    
next...

Upgrade from 1.1.2

A new table to hold the various timezones of the world. How far from Greenich Mean Time? When does Daylight Savings start / end, if applicable.

CREATE TABLE webcal_timezones (
  tzid varchar(100) NOT NULL default '',
  dtstart varchar(25) default NULL,
  dtend varchar(25) default NULL,
  vtimezone text,
  PRIMARY KEY (tzid)
);
    
next...

Upgrade from 1.1.3

// Craig. This LOOKS like an extensive upgrade. However, mostly it's just putting the table / field /*comments*/ from "install/sql/tables-mysql.sql" in the actual database to make maintaining it easier. Also, phpMyAdmin can use the "COMMENT"s to create a replacement for "docs/WebCalendar-Database.html" without the need for "docs/sql2html.pl". Mostly. It isn't quite as clean:

But, it looks the same otherwise.

phpMyAdmin "export" puts the "ENGINE" and "CHARSET" in the file, so I included them, too.
I am also utilizing MySQL / MariaDB field types such as enum, tinyint, etc. to better show what the field is about.

Converting from MySQL / Maria to all the other dababase types supported by WebCalendar only takes about 50 lines total, mostly preg_replace() with arrays, in a switch construct. We would only need a single "tables.sql" and a single "upgrade.sql" instead of all the variants. (Work in progress.)

The new table, "webcal_translations" (not yet used) to hold the various language translations. Eventually would eliminate all the various "translations/*.txt" files. "tools/update_translation.pl" could create the sql files to load it, while creating the *.txt files for the translators.

I'm also looking at consolidating some fields / tables into webcal_user_pref. Only takes about 100 lines of code changes. Not counting the "/*Consolodate some fields*/" section below. What do you think? bb

ALTER TABLE webcal_access_user ENGINE MyISAM CHARACTER SET utf8 COMMENT 'Specifies which users can access another user''s calendar.';
ALTER TABLE webcal_access_user MODIFY cal_see_time_only ENUM('N','Y') NOT NULL DEFAULT 'N' COMMENT 'Can current user can only see time of other user?';
ALTER TABLE webcal_access_user MODIFY cal_can_view smallint UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Can current user view events on the other user''s calendar?' FIRST;
ALTER TABLE webcal_access_user MODIFY cal_can_invite ENUM('N','Y') NOT NULL DEFAULT 'Y' COMMENT 'Can current user see other user in Participant lists?' FIRST;
ALTER TABLE webcal_access_user MODIFY cal_can_email ENUM('N','Y') DEFAULT 'Y' COMMENT 'Can current user send emails to other user?' FIRST;
ALTER TABLE webcal_access_user MODIFY cal_can_edit smallint UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Can current user edit events on the other user''s calendar?' FIRST;
ALTER TABLE webcal_access_user MODIFY cal_can_approve smallint UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Can current user approve events on the other user''s calendar?' FIRST;
ALTER TABLE webcal_access_user MODIFY cal_other_user varchar(25) NOT NULL COMMENT 'The login of the other user whose calendar the current user wants to access. Also, from <a href="#webcal_user">webcal_user</a> table.' FIRST;
ALTER TABLE webcal_access_user MODIFY cal_login varchar(25) NOT NULL COMMENT 'The current user who is attempting to look at another user''s calendar. From <a href="#webcal_user">webcal_user</a> table.' FIRST;

ALTER TABLE webcal_access_function ENGINE MyISAM CHARACTER SET utf8 COMMENT 'Specifies what WebCalendar functions a user can access. Each function has a corresponding numeric value (specified in the file includes/access.php). For example, view event is 0, so the very first character in the cal_permissions column is either a "Y" if this user can view events or a "N" if they cannot.';
ALTER TABLE webcal_access_function MODIFY cal_login varchar(25) NOT NULL COMMENT 'User login. From <a href="#webcal_user">webcal_user</a> table.' FIRST;
ALTER TABLE webcal_access_function MODIFY cal_permissions varchar(64) NOT NULL COMMENT 'A string of "Y"s and/or "N"s for the various functions.';

ALTER TABLE webcal_asst ENGINE MyISAM CHARACTER SET utf8 COMMENT 'Define assistant/boss relationship.';
ALTER TABLE webcal_asst MODIFY cal_assistant varchar(25) NOT NULL COMMENT 'Assistant login. Also from <a href="#webcal_user">webcal_user</a> table.';
ALTER TABLE webcal_asst MODIFY cal_boss varchar(25) NOT NULL COMMENT 'Boss login. From <a href="#webcal_user">webcal_user</a> table.' FIRST;

ALTER TABLE webcal_blob ENGINE MyISAM CHARACTER SET utf8 COMMENT 'This table stores event attachments and comments.';
ALTER TABLE webcal_blob MODIFY cal_type ENUM('A','C') NOT NULL DEFAULT 'C' COMMENT 'Type of object: C=Comment, A=Attachment.' FIRST;
ALTER TABLE webcal_blob MODIFY cal_size int UNSIGNED DEFAULT NULL COMMENT 'Size of object (not used for comments).' FIRST;
ALTER TABLE webcal_blob MODIFY cal_name varchar(30) DEFAULT NULL COMMENT 'Filename of object (not used for comments).' FIRST;
ALTER TABLE webcal_blob MODIFY cal_mod_time time NOT NULL COMMENT 'Time added.' FIRST;
ALTER TABLE webcal_blob ADD cal_mod TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'When was this added / changed?' FIRST;
ALTER TABLE webcal_blob MODIFY cal_mod TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'When was this added / changed?' FIRST;
ALTER TABLE webcal_blob MODIFY cal_mime_type varchar(50) DEFAULT NULL COMMENT 'MIME type of object (as specified by browser during upload (not used for comment).' FIRST;
ALTER TABLE webcal_blob MODIFY cal_login varchar(25) DEFAULT NULL COMMENT 'Login of user who created. From <a href="#webcal_user">webcal_user</a> table.' FIRST;
ALTER TABLE webcal_blob MODIFY cal_id int UNSIGNED DEFAULT NULL COMMENT 'Event id (if applicable). From <a href="#webcal_entry">webcal_entry</a> table.' FIRST;
ALTER TABLE webcal_blob MODIFY cal_description varchar(128) DEFAULT NULL COMMENT 'Description of what the object is (subject for comment).' FIRST;
ALTER TABLE webcal_blob MODIFY cal_blob_id int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Unique identifier for this object.' FIRST;
ALTER TABLE webcal_blob MODIFY cal_blob longblob COMMENT 'Binary data for object.';
ALTER TABLE webcal_blob ADD UNIQUE KEY wb_cl_cd (cal_login,cal_description);

ALTER TABLE webcal_categories ENGINE MyISAM CHARACTER SET utf8 COMMENT 'Defines user categories. Categories can be specific to a user or global. When a category is global, the cat_owner field will be NULL. (Only an admin user can create a global category.)';
ALTER TABLE webcal_categories MODIFY cat_name varchar(80) NOT NULL COMMENT 'Category name.' FIRST;
ALTER TABLE webcal_categories MODIFY cat_color varchar(7) DEFAULT NULL COMMENT 'RGB color for category.' FIRST;
ALTER TABLE webcal_categories MODIFY cat_id int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Unique category id.' FIRST;
ALTER TABLE webcal_categories MODIFY cat_owner varchar(25) DEFAULT NULL COMMENT 'User login of category owner. From <a href="#webcal_user">webcal_user</a> table, if applicable. If this is NULL, then it is a global category.';

ALTER TABLE webcal_config ENGINE MyISAM CHARACTER SET utf8 COMMENT 'System settings (set by the admin interface in admin.php).';
ALTER TABLE webcal_config MODIFY cal_setting varchar(50) NOT NULL COMMENT 'System setting.' FIRST;
ALTER TABLE webcal_config MODIFY cal_value varchar(100) NULL COMMENT 'System setting value.';

ALTER TABLE webcal_entry ENGINE MyISAM CHARACTER SET utf8 COMMENT 'Defines a calendar event. Each event in the system has one entry in this table unless the event starts before midnight and ends after midnight. In that case a secondary event will be created with cal_ext_for_id set to the cal_id of the original entry. The following tables contain additional information about each event:<ul><li><a href="#webcal_entry_user">webcal_entry_user</a> table - lists participants in the event and specifies the status (accepted, rejected) and category of each participant.</li><li><a href="#webcal_entry_repeats">webcal_entry_repeats</a> table - contains information if the event repeats.</li><li><a href="#webcal_entry_repeats_not">webcal_entry_repeats_not</a> table - specifies which dates the repeating event does not repeat (because they were deleted or modified for just that date by the user.)</li><li><a href="#webcal_entry_log">webcal_entry_log</a> table - provides a history of changes to this event.</li><li><a href="#webcal_site_extras">webcal_site_extras</a> table - stores event data as defined in site_extras.php (such as reminders and other custom event fields).</li></ul>';
ALTER TABLE webcal_entry MODIFY cal_url varchar(100) DEFAULT NULL COMMENT 'URL of event.';
ALTER TABLE webcal_entry MODIFY cal_type ENUM('E','M','T') DEFAULT 'E' COMMENT '"E" = Event, "M" = Repeating event, "T" = Task.' FIRST;
ALTER TABLE webcal_entry MODIFY cal_time time DEFAULT NULL COMMENT 'Event start time.' FIRST;
ALTER TABLE webcal_entry MODIFY cal_priority tinyint UNSIGNED DEFAULT '5' COMMENT 'Event priority: 1=High, 9=Low.' FIRST;
ALTER TABLE webcal_entry MODIFY cal_name varchar(80) NOT NULL COMMENT 'Brief description of event.' FIRST;
ALTER TABLE webcal_entry MODIFY cal_mod_time time DEFAULT NULL COMMENT 'Time the event was last modified.' FIRST;
ALTER TABLE webcal_entry ADD cal_mod TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'When was this added / changed?' FIRST;
ALTER TABLE webcal_entry MODIFY cal_mod TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'When was this added / changed?' FIRST;
ALTER TABLE webcal_entry MODIFY cal_location varchar(100) DEFAULT NULL COMMENT 'Location of event.' FIRST;
ALTER TABLE webcal_entry MODIFY cal_group_id int UNSIGNED DEFAULT NULL COMMENT 'The parent event id if this event is overriding an occurrence of a repeating event. From this table.' FIRST;
ALTER TABLE webcal_entry MODIFY cal_ext_for_id int UNSIGNED DEFAULT NULL COMMENT 'Used when an event goes past midnight into the next day, in which case an additional entry in this table will use this field to indicate the original event cal_id.' FIRST;
ALTER TABLE webcal_entry MODIFY cal_duration int UNSIGNED NOT NULL COMMENT 'Duration of event in minutes.' FIRST;
ALTER TABLE webcal_entry MODIFY cal_due_time time DEFAULT NULL COMMENT 'Task due time.' FIRST;
ALTER TABLE webcal_entry ADD cal_due datetime DEFAULT NULL COMMENT 'When is this task due?' FIRST;
ALTER TABLE webcal_entry MODIFY cal_due datetime DEFAULT NULL COMMENT 'When is this task due?' FIRST;
ALTER TABLE webcal_entry ADD cal_datetime datetime NOT NULL COMMENT 'When is this event scheduled to start?' FIRST;
ALTER TABLE webcal_entry MODIFY cal_datetime datetime NOT NULL COMMENT 'When is this event scheduled to start?' FIRST;
ALTER TABLE webcal_entry MODIFY cal_date date NOT NULL COMMENT 'Date of event.' FIRST;
ALTER TABLE webcal_entry MODIFY cal_create_by varchar(25) NOT NULL COMMENT 'Login of user that created the event. From <a href="#webcal_user">webcal_user</a> table.' FIRST;
ALTER TABLE webcal_entry MODIFY cal_completed date DEFAULT NULL COMMENT 'Date task completed.' FIRST;
ALTER TABLE webcal_entry MODIFY cal_access ENUM('C','P','R') DEFAULT 'P' COMMENT '"P" = Public, "R" = Private (others cannot see the event), "C" = Confidential (others can see time allocated but not what it is).' FIRST;
ALTER TABLE webcal_entry MODIFY cal_id int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Unique integer id for event.' FIRST;
UPDATE webcal_entry SET cal_datetime = CONCAT(cal_date,cal_time);
UPDATE webcal_entry SET cal_due = CONCAT(cal_due_date,cal_due_time);

ALTER TABLE webcal_entry_categories ENGINE MyISAM CHARACTER SET utf8 COMMENT 'Contains category foreign keys to enable multiple categories for each event or task.';
ALTER TABLE webcal_entry_categories MODIFY cat_owner varchar(25) DEFAULT NULL COMMENT 'User that owns this record. Global categories will be NULL. From <a href="#webcal_user">webcal_user</a> table.' FIRST;
ALTER TABLE webcal_entry_categories MODIFY cat_order int UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Order that user requests their categories appear. Globals are always last.';
ALTER TABLE webcal_entry_categories MODIFY cat_id int UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Id of category from <a href="webcal_categories">webcal_categories</a> table.' FIRST;
ALTER TABLE webcal_entry_categories MODIFY cal_id int UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Id of event from <a href="webcal_entry">webcal_entry</a> table.' FIRST;

ALTER TABLE webcal_entry_ext_user ENGINE MyISAM CHARACTER SET utf8 COMMENT 'External user (no login) for an event.';
ALTER TABLE webcal_entry_ext_user MODIFY cal_fullname varchar(50) NOT NULL COMMENT 'external user full name';
ALTER TABLE webcal_entry_ext_user MODIFY cal_email varchar(75) NULL COMMENT 'external user email (for sending a reminder)' FIRST;
ALTER TABLE webcal_entry_ext_user MODIFY cal_id int UNSIGNED NOT NULL DEFAULT '0' COMMENT 'From <a href="webcal_entry">webcal_entry</a> table.' FIRST;

ALTER TABLE webcal_entry_log ENGINE MyISAM CHARACTER SET utf8 COMMENT 'Activity log for an event.';
ALTER TABLE webcal_entry_log MODIFY cal_user_cal varchar(25) DEFAULT NULL COMMENT 'User of calendar affected. Also from <a href="#webcal_user">webcal_user</a> table.' FIRST;
ALTER TABLE webcal_entry_log MODIFY cal_type ENUM('A','C','E','M','R','U') NOT NULL DEFAULT 'C' COMMENT 'Log types:<ul><li>C: Created</li><li>A: Approved/Confirmed by user</li><li>R: Rejected by user</li><li>U: Updated by user</li><li>M: Mail Notification sent</li><li>E: Reminder sent</li></ul>' FIRST;
ALTER TABLE webcal_entry_log MODIFY cal_time time DEFAULT NULL FIRST;
ALTER TABLE webcal_entry_log MODIFY cal_text text COMMENT 'Optional text.';
ALTER TABLE webcal_entry_log ADD cal_mod TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'When was this added / changed?' FIRST;
ALTER TABLE webcal_entry_log MODIFY cal_login varchar(25) NOT NULL COMMENT 'User who performed this action. From <a href="#webcal_user">webcal_user</a> table.' FIRST;
ALTER TABLE webcal_entry_log MODIFY cal_entry_id int UNSIGNED NOT NULL COMMENT 'Event id. From <a href="#webcal_entry">webcal_entry</a> table.' FIRST;
ALTER TABLE webcal_entry_log MODIFY cal_date date NOT NULL FIRST;
ALTER TABLE webcal_entry_log MODIFY cal_log_id int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Unique id of this log entry.' FIRST;

ALTER TABLE webcal_entry_repeats ENGINE MyISAM CHARACTER SET utf8 COMMENT 'Defines repeating info about an event. The event is defined in <a href="#webcal_entry">webcal_entry</a> table.';
ALTER TABLE webcal_entry_repeats MODIFY cal_type varchar(20) DEFAULT NULL COMMENT 'Type of repeating:<ul><li>daily - repeats daily</li><li>monthlyByDate - repeats on same day of the month</li><li>monthlyBySetPos - repeats based on position within other ByXXX values</li><li>monthlyByDay - repeats on specified weekday, (2nd Monday, for example)</li><li>weekly - repeats every week</li><li>yearly - repeats on same date every year</li></ul>' FIRST;
ALTER TABLE webcal_entry_repeats MODIFY cal_frequency int UNSIGNED DEFAULT '1' COMMENT 'Frequency of repeat: 1 = every, 2 = every other, 3 = every 3rd, etc.' FIRST;
ALTER TABLE webcal_entry_repeats ADD cal_enddt datetime DEFAULT NULL COMMENT 'End date and time for repeating event.' FIRST;
ALTER TABLE webcal_entry_repeats MODIFY cal_enddt datetime DEFAULT NULL COMMENT 'End date and time for repeating event.' FIRST;
ALTER TABLE webcal_entry_repeats MODIFY cal_end date DEFAULT NULL COMMENT 'End date for repeating event.' FIRST;
ALTER TABLE webcal_entry_repeats MODIFY cal_wkst ENUM('MO','TU','WE','TH','FR','SA','SU') DEFAULT 'MO' COMMENT 'Week starts on...';
ALTER TABLE webcal_entry_repeats MODIFY cal_days ENUM('N','Y') DEFAULT NULL COMMENT 'NO LONGER USED. We''ll leave it in for now.' FIRST;
ALTER TABLE webcal_entry_repeats MODIFY cal_count int UNSIGNED DEFAULT NULL FIRST;
ALTER TABLE webcal_entry_repeats MODIFY cal_byyearday varchar(50) DEFAULT NULL FIRST;
ALTER TABLE webcal_entry_repeats MODIFY cal_byweekno varchar(50) DEFAULT NULL FIRST;
ALTER TABLE webcal_entry_repeats MODIFY cal_bysetpos varchar(50) DEFAULT NULL FIRST;
ALTER TABLE webcal_entry_repeats MODIFY cal_bymonthday varchar(100) DEFAULT NULL FIRST;
ALTER TABLE webcal_entry_repeats MODIFY cal_bymonth varchar(50) DEFAULT NULL FIRST;
ALTER TABLE webcal_entry_repeats MODIFY cal_byday varchar(100) DEFAULT NULL COMMENT 'The following columns are values as specified in RFC2445.' FIRST;
ALTER TABLE webcal_entry_repeats MODIFY cal_id int UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Event id. From <a href="#webcal_entry">webcal_entry</a> table.' FIRST;
UPDATE webcal_entry_repeats SET cal_enddt = CONCAT(cal_end,cal_endtime);

ALTER TABLE webcal_entry_repeats_not ENGINE MyISAM CHARACTER SET utf8 COMMENT 'This table specifies which dates in a repeating event have either been deleted, included, or replaced with another event for that day. When replaced, the cal_group_id (I know... not the best name, but it was not being used) column will be set to the original event. That way the user can delete the original event and (at the same time) delete any exception events.';
ALTER TABLE webcal_entry_repeats_not MODIFY cal_date DATE NOT NULL COMMENT 'Date event should not repeat.' FIRST;
ALTER TABLE webcal_entry_repeats_not MODIFY cal_id int UNSIGNED NOT NULL COMMENT 'Event id of repeating event. From <a href="#webcal_entry">webcal_entry</a> table.' FIRST;
ALTER TABLE webcal_entry_repeats_not MODIFY cal_exdate tinyint UNSIGNED NOT NULL DEFAULT '1' COMMENT 'Indicates whether this record is an exclusion1) or inclusion0).';

ALTER TABLE webcal_entry_user ENGINE MyISAM CHARACTER SET utf8 COMMENT 'This table associates one or more users with an event by the event id. The event can be found in <a href="#webcal_entry">webcal_entry</a> table.';
ALTER TABLE webcal_entry_user MODIFY cal_status ENUM('A','C','D','P','R','W') DEFAULT 'A' COMMENT 'Status of event for this user:<ul><li>A=Accepted</li><li>C=Completed</li><li>D=Deleted</li><li>P=In-Progress</li><li>R=Rejected/Declined</li><li>W=Waiting</li></ul>';
ALTER TABLE webcal_entry_user MODIFY cal_percent tinyint UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Task percentage of completion for this user''s task.' FIRST;
ALTER TABLE webcal_entry_user MODIFY cal_category int UNSIGNED DEFAULT NULL COMMENT 'Category of the event for this user.' FIRST;
ALTER TABLE webcal_entry_user MODIFY cal_login varchar(25) NOT NULL COMMENT 'Participant in the event. From <a href="#webcal_user">webcal_user</a> table.' FIRST;
ALTER TABLE webcal_entry_user MODIFY cal_id int UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Event id. From <a href="#webcal_entry">webcal_entry</a> table.' FIRST;

ALTER TABLE webcal_group ENGINE MyISAM CHARACTER SET utf8 COMMENT 'Define a group. Group members can be found in <a href="#webcal_group_user">webcal_group_user</a> table.';
ALTER TABLE webcal_group MODIFY cal_owner varchar(25) DEFAULT NULL COMMENT 'User login of user that created this group. From <a href="#webcal_user">webcal_user</a> table.';
ALTER TABLE webcal_group MODIFY cal_name varchar(50) NOT NULL COMMENT 'Name of the group.' FIRST;
ALTER TABLE webcal_group MODIFY cal_last_update TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Date last updated.' FIRST;
ALTER TABLE webcal_group MODIFY cal_group_id int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Unique group id.' FIRST;

ALTER TABLE webcal_group_user ENGINE MyISAM CHARACTER SET utf8 COMMENT 'Group members.';
ALTER TABLE webcal_group_user MODIFY cal_login varchar(25) NOT NULL COMMENT 'From <a href="webcal_user">webcal_user</a>';
ALTER TABLE webcal_group_user MODIFY cal_group_id int UNSIGNED NOT NULL COMMENT 'From <a href="webcal_group">webcal_group</a>' FIRST;

ALTER TABLE webcal_import ENGINE MyISAM CHARACTER SET utf8 COMMENT 'Used to track import data (one row per import).';
ALTER TABLE webcal_import MODIFY cal_type varchar(10) NOT NULL COMMENT 'Type of import (ical, vcal, palm, outlookcsv).';
ALTER TABLE webcal_import MODIFY cal_name varchar(50) DEFAULT NULL COMMENT 'Name of import (optional).' FIRST;
ALTER TABLE webcal_import MODIFY cal_login varchar(25) DEFAULT NULL COMMENT 'User who performed the import.' FIRST;
ALTER TABLE webcal_import MODIFY cal_date TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Datetime of import.' FIRST;
ALTER TABLE webcal_import MODIFY cal_import_id int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Unique id for import.' FIRST;

ALTER TABLE webcal_import_data ENGINE MyISAM CHARACTER SET utf8 COMMENT 'Used to track import data (one row per event).';
ALTER TABLE webcal_import_data MODIFY cal_import_type varchar(15) NOT NULL COMMENT 'Type of import: "palm", "vcal", "ical" or "outlookcsv".';
ALTER TABLE webcal_import_data MODIFY cal_import_id int UNSIGNED NOT NULL COMMENT 'Import id (From <a href="#webcal_import">webcal_import</a> table.' FIRST;
ALTER TABLE webcal_import_data MODIFY cal_external_id varchar(200) DEFAULT NULL COMMENT 'External id used in external calendar system (for example, UID in iCal).' FIRST;
ALTER TABLE webcal_import_data MODIFY cal_login varchar(25) NOT NULL COMMENT 'User login. From <a href="#webcal_user">webcal_user</a> table.' FIRST;
ALTER TABLE webcal_import_data MODIFY cal_id int UNSIGNED NOT NULL COMMENT 'Event id in WebCalendar. From <a href="#webcal_entry">webcal_entry</a> table.' FIRST;

ALTER TABLE webcal_nonuser_cals ENGINE MyISAM CHARACTER SET utf8 COMMENT 'Defines non-user calendars.';
ALTER TABLE webcal_nonuser_cals MODIFY cal_url varchar(255) DEFAULT NULL COMMENT 'URL of the remote calendar.';
ALTER TABLE webcal_nonuser_cals MODIFY cal_lastname varchar(25) DEFAULT NULL COMMENT 'Calendar''s last name.' FIRST;
ALTER TABLE webcal_nonuser_cals MODIFY cal_is_public ENUM('N','Y') NOT NULL DEFAULT 'N' COMMENT 'Can this nonuser calendar be a public calendar (no login required)?' FIRST;
ALTER TABLE webcal_nonuser_cals MODIFY cal_firstname varchar(25) DEFAULT NULL COMMENT 'Calendar'' first name.' FIRST;
ALTER TABLE webcal_nonuser_cals ADD cal_displayname varchar(50) DEFAULT NULL COMMENT 'Name to diplay on public or other user''s calendars.' FIRST;
ALTER TABLE webcal_nonuser_cals MODIFY cal_admin varchar(25) NOT NULL COMMENT 'The calendar administrator. From <a href="#webcal_user">webcal_user</a> table.' FIRST;
ALTER TABLE webcal_nonuser_cals MODIFY cal_login varchar(25) NOT NULL COMMENT 'Unique id for the calendar.' FIRST;
UPDATE webcal_nonuser_cals SET cal_displayname = CONCAT_WS(' ',cal_firstname,cal_lastname);

ALTER TABLE webcal_reminders ENGINE MyISAM CHARACTER SET utf8 COMMENT 'Stores information about reminders.';
ALTER TABLE webcal_reminders MODIFY cal_times_sent int UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Number of times this reminder has been sent.';
ALTER TABLE webcal_reminders MODIFY cal_repeats int UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Number of times to repeat in addition to original occurrence.' FIRST;
ALTER TABLE webcal_reminders MODIFY cal_related ENUM('E','S') NOT NULL DEFAULT 'S' COMMENT 'S=Start, E=End. Specifies which edge of entry this reminder applies to.' FIRST;
ALTER TABLE webcal_reminders MODIFY cal_offset int UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Offset in minutes from the selected edge.' FIRST;
ALTER TABLE webcal_reminders MODIFY cal_last_sent datetime NOT NULL COMMENT 'Timestamp of last sent reminder.' FIRST;
ALTER TABLE webcal_reminders MODIFY cal_duration int UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Time in ISO 8601 format that specifies time between repeated reminders.' FIRST;
ALTER TABLE webcal_reminders MODIFY cal_date datetime NOT NULL COMMENT 'When to send? Use this or cal_offset, but not both.' FIRST;
ALTER TABLE webcal_reminders MODIFY cal_before ENUM('N','Y') NOT NULL DEFAULT 'Y' COMMENT 'Specifies whether reminder is sent before or after selected edge.' FIRST;
ALTER TABLE webcal_reminders MODIFY cal_action varchar(12) NOT NULL DEFAULT 'EMAIL' COMMENT 'Action as imported, may be used in the future.' FIRST;
ALTER TABLE webcal_reminders MODIFY cal_id int UNSIGNED NOT NULL DEFAULT '0' FIRST;

ALTER TABLE webcal_report ENGINE MyISAM CHARACTER SET utf8 COMMENT 'Defines a custom report created by a user.';
ALTER TABLE webcal_report MODIFY cal_user varchar(25) DEFAULT NULL COMMENT 'User calendar to display (NULL indicates current user).';
ALTER TABLE webcal_report MODIFY cal_update_date date NOT NULL COMMENT 'Date created or last updated.' FIRST;
ALTER TABLE webcal_report MODIFY cal_time_range int UNSIGNED NOT NULL COMMENT 'Time range for report:<ul><li>0 = tomorrow</li><li>1 = today</li><li>2 = yesterday</li><li>3 = day before yesterday</li><li>10 = next week</li><li>11 = current week</li><li>12 = last week</li><li>13 = week before last</li><li>20 = next week and week after</li><li>21 = current week and next week</li><li>22 = last week and this week</li><li>23 = last two weeks</li><li>30 = next month</li><li>31 = current month</li><li>32 = last month</li><li>33 = month before last</li><li>40 = next year</li><li>41 = current year</li><li>42 = last year</li><li>43 = year before last</li></ul>' FIRST;
ALTER TABLE webcal_report MODIFY cal_show_in_trailer ENUM('N','Y') DEFAULT 'N' COMMENT 'Include a link for this report in the "Go to" section of the navigation in the page trailer? ("Y" or "N")' FIRST;
ALTER TABLE webcal_report MODIFY cal_report_type varchar(20) NOT NULL COMMENT 'Format of report (html, plain or csv).' FIRST;
ALTER TABLE webcal_report MODIFY cal_report_name varchar(50) NOT NULL COMMENT 'Name of the report.' FIRST;
ALTER TABLE webcal_report ADD cal_mod TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Created or last updated.' FIRST;
ALTER TABLE webcal_report MODIFY cal_login varchar(25) NOT NULL COMMENT 'Creator of report.' FIRST;
ALTER TABLE webcal_report MODIFY cal_is_global ENUM('N','Y') NOT NULL DEFAULT 'N' COMMENT 'Is this a global report (can it be accessed by other users - "Y" or "N")' FIRST;
ALTER TABLE webcal_report MODIFY cal_include_header ENUM('N','Y') NOT NULL DEFAULT 'Y' COMMENT 'If cal_report_type is "html", should the default HTML header and trailer be included? ("Y" or "N")' FIRST;
ALTER TABLE webcal_report MODIFY cal_include_empty ENUM('N','Y') DEFAULT 'N' COMMENT 'Include empty dates in report ("Y" or "N").' FIRST;
ALTER TABLE webcal_report MODIFY cal_cat_id int UNSIGNED DEFAULT NULL COMMENT 'Category to filter on (optional).' FIRST;
ALTER TABLE webcal_report MODIFY cal_allow_nav ENUM('N','Y') DEFAULT 'Y' COMMENT 'Allow user to navigate to different dates with next/previous? ("Y" or "N")' FIRST;
ALTER TABLE webcal_report MODIFY cal_report_id int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Unique id of this report.' FIRST;

ALTER TABLE webcal_report_template ENGINE MyISAM CHARACTER SET utf8 COMMENT 'Defines one of the templates used for a report. Each report has three templates: <ol><li>Page template - Defines the entire page (except for header and footer). The following variables can be defined:<ul><li>${days}<sup>*</sup> - the HTML of all dates (generated from the Date template)</li></ul></li><li>Date template - Defines events for one day. If the report is for a week or month, then the results of each day will be concatenated and used as the ${days} variable in the Page template. The following variables can be defined:<ul><li>${events}<sup>*</sup> - the HTML of all events for the data (generated from the Event template)</li><li>${date} - the date</li><li>${fulldate} - date (includes weekday)</li></ul></li><li>Event template - Defines a single event. The following variables can be defined: <ul><li>${name}<sup>*</sup> - Brief Description of event</li><li>${description} - Full Description of event</li><li>${date} - Date of event</li><li>${fulldate} - Date of event (includes weekday)</li><li>${time} - Time of event (4:00pm - 4:30pm)</li><li>${starttime} - Start time of event</li><li>${endtime} - End time of event</li><li>${duration} - Duration of event (in minutes)</li><li>${priority} - Priority of event</li><li>${href} - URL to view event details</li></ul></li></ol><sup>*</sup> denotes a required template variable.';
ALTER TABLE webcal_report_template MODIFY cal_template_type ENUM('D','E','P') NOT NULL DEFAULT "P" COMMENT 'Type of template:<ul><li>"P": page template represents entire document</li><li>"D": date template represents a single day of events</li><li>"E": event template represents a single event</li></ul>' FIRST;
ALTER TABLE webcal_report_template MODIFY cal_template_text text COMMENT 'Text of template.';
ALTER TABLE webcal_report_template MODIFY cal_report_id int UNSIGNED NOT NULL COMMENT 'Report id from <a href="webcal_report table">webcal_report</a> table.' FIRST;

ALTER TABLE webcal_site_extras ENGINE MyISAM CHARACTER SET utf8 COMMENT 'This table holds data for site extra fields (customized in site_extra.php).';
ALTER TABLE webcal_site_extras MODIFY cal_type int UNSIGNED NOT NULL COMMENT 'EXTRA_URL, EXTRA_DATE, etc.' FIRST;
ALTER TABLE webcal_site_extras MODIFY cal_remind int UNSIGNED DEFAULT '0' COMMENT 'How many minutes before event should a reminder be sent.' FIRST;
ALTER TABLE webcal_site_extras MODIFY cal_name varchar(25) NOT NULL COMMENT 'The brief name of this type (first field in $site_extra array).' FIRST;
ALTER TABLE webcal_site_extras MODIFY cal_id int UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Event id from <a href="webcal_entry">webcal_entry</a> table.' FIRST;
ALTER TABLE webcal_site_extras MODIFY cal_date DATE NULL DEFAULT NULL COMMENT 'Only used for EXTRA_DATE type fields.' FIRST;
ALTER TABLE webcal_site_extras MODIFY cal_data text COMMENT 'Used to store text data.';

ALTER TABLE webcal_timezones ENGINE MyISAM CHARACTER SET utf8 COMMENT 'This table stores timezones of the world.';
ALTER TABLE webcal_timezones MODIFY vtimezone text COMMENT 'Complete VTIMEZONE text gleaned from imported ics files.';
ALTER TABLE webcal_timezones MODIFY tzid varchar(100) NOT NULL DEFAULT '' COMMENT 'Unique name of timezone, try to use Olsen naming conventions.' FIRST;
ALTER TABLE webcal_timezones MODIFY dtstart varchar(16) DEFAULT NULL COMMENT 'Earliest date this timezone represents in YYYYMMDDTHHMMSSZ format.' FIRST;
ALTER TABLE webcal_timezones MODIFY dtend varchar(16) DEFAULT NULL COMMENT 'Last date this timezone represents in YYYYMMDDTHHMMSSZ format.' FIRST;

DROP TABLE IF EXISTS webcal_translations;
CREATE TABLE IF NOT EXISTS webcal_translations (
 phrase varchar(300) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL COMMENT 'The translate / tooltip (phrases) from the code. And the __phrase__ from version 2.0.0. ("latin1" is currently the only choice that is case sensitive.)',
 on_page varchar(50) NOT NULL COMMENT 'which code page (sorted alphabetically) has the first occurance of the above phrase.',
 English_US varchar(300) NOT NULL COMMENT 'The full English text.',
 Afrikaans varchar(300) NOT NULL,
 Albanian varchar(300) NOT NULL,
 Arabic varchar(300) NOT NULL,
 Armenian varchar(300) NOT NULL,
 Azerbaijan varchar(300) NOT NULL,
 Basque varchar(300) NOT NULL,
 Belarusian varchar(300) NOT NULL,
 Bulgarian varchar(300) NOT NULL,
 Catalan varchar(300) NOT NULL,
 Chamorro varchar(300) NOT NULL,
 Chinese_Big5 varchar(300) NOT NULL,
 Chinese_GB2312 varchar(300) NOT NULL,
 Croatian varchar(300) CHARACTER SET utf8 COLLATE utf8_croatian_ci NOT NULL,
 Czech varchar(300) CHARACTER SET utf8 COLLATE utf8_czech_ci NOT NULL,
 Danish varchar(300) CHARACTER SET utf8 COLLATE utf8_danish_ci NOT NULL,
 Dutch varchar(300) NOT NULL,
 Elven varchar(300) NOT NULL COMMENT 'From JRR Tolkien "Hobbit" and "Lord of the Rings".',
 Esperanto varchar(300) CHARACTER SET utf8 COLLATE utf8_esperanto_ci NOT NULL,
 Estonian varchar(300) CHARACTER SET utf8 COLLATE utf8_estonian_ci NOT NULL,
 Faroese varchar(300) NOT NULL,
 Farsi varchar(300) NOT NULL,
 Finnish varchar(300) NOT NULL,
 French varchar(300) NOT NULL,
 Galician varchar(300) NOT NULL,
 Georgian varchar(300) NOT NULL,
 German varchar(300) CHARACTER SET utf8 COLLATE utf8_german2_ci NOT NULL,
 Greek varchar(300) NOT NULL,
 Hebrew varchar(300) NOT NULL,
 Hungarian varchar(300) CHARACTER SET utf8 COLLATE utf8_hungarian_ci NOT NULL,
 Icelandic varchar(300) CHARACTER SET utf8 COLLATE utf8_icelandic_ci NOT NULL,
 Indonesian varchar(300) NOT NULL,
 Italian varchar(300) NOT NULL,
 Japanese varchar(300) NOT NULL,
 Klingon varchar(300) NOT NULL,
 Korean varchar(300) NOT NULL,
 Latvian varchar(300) CHARACTER SET utf8 COLLATE utf8_latvian_ci NOT NULL,
 Lithuanian varchar(300) CHARACTER SET utf8 COLLATE utf8_lithuanian_ci NOT NULL,
 Malaysian varchar(300) NOT NULL,
 Myanmar varchar(300) CHARACTER SET utf8 COLLATE utf8_myanmar_ci NOT NULL,
 Norwegian varchar(300) NOT NULL,
 Persian varchar(300) CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
 Polish varchar(300) CHARACTER SET utf8 COLLATE utf8_polish_ci NOT NULL,
 Portuguese varchar(300) NOT NULL,
 Portuguese_BR varchar(300) NOT NULL,
 Romanian varchar(300) CHARACTER SET utf8 COLLATE utf8_romanian_ci NOT NULL,
 Russian varchar(300) NOT NULL,
 Serbian varchar(300) NOT NULL,
 Sinhala varchar(300) CHARACTER SET utf8 COLLATE utf8_sinhala_ci NOT NULL,
 Slovakian varchar(300) CHARACTER SET utf8 COLLATE utf8_slovak_ci NOT NULL,
 Slovenian varchar(300) CHARACTER SET utf8 COLLATE utf8_slovenian_ci NOT NULL,
 Spanish varchar(300) CHARACTER SET utf8 COLLATE utf8_spanish_ci NOT NULL,
 Swedish varchar(300) NOT NULL,
 Taiwanese varchar(300) NOT NULL,
 Turkish varchar(300) CHARACTER SET utf8 COLLATE utf8_turkish_ci NOT NULL,
 Ukrainian varchar(300) NOT NULL,
 Vietnamese varchar(300) CHARACTER SET utf8 COLLATE utf8_vietnamese_ci NOT NULL,
 Welsh varchar(300) NOT NULL,
 PRIMARY KEY (phrase),
 KEY wt_op (on_page)
) ENGINE MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Various language translations.';

ALTER TABLE webcal_user ENGINE MyISAM CHARACTER SET utf8 COMMENT 'Defines a WebCalendar user.';
ALTER TABLE webcal_user ADD cal_type ENUM('A','N','S','U') DEFAULT 'U' COMMENT 'Is this an A)dmin, N)on_user, S)ystem, or ordinary U)ser? Will evevtually replace is_admin.';
ALTER TABLE webcal_user MODIFY cal_passwd varchar(32) DEFAULT NULL COMMENT 'The user''s password (not used for http.)' FIRST;
ALTER TABLE webcal_user ADD cal_mod TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'User''s last log in.' FIRST;
ALTER TABLE webcal_user MODIFY cal_last_login timestamp on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Date user last logged in.' FIRST;
ALTER TABLE webcal_user MODIFY cal_is_admin ENUM('N','Y') DEFAULT 'N' COMMENT 'Is the user a WebCalendar administrator? (Y or N)' FIRST;
ALTER TABLE webcal_user MODIFY cal_enabled ENUM('N','Y') DEFAULT 'Y' COMMENT 'Allow admin to disable account? (Y or N)' FIRST;
ALTER TABLE webcal_user MODIFY cal_login varchar(25) NOT NULL COMMENT 'Unique user login.' FIRST;
UPDATE webcal_user SET cal_type = 'U' WHERE cal_is_admin = 'N';
UPDATE webcal_user SET cal_type = 'A' WHERE cal_is_admin = 'Y';

ALTER TABLE webcal_user_layers ENGINE MyISAM CHARACTER SET utf8 COMMENT 'Define layers for a user.';
ALTER TABLE webcal_user_layers MODIFY cal_layerid int UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE COMMENT 'Unique layer id.' FIRST;
ALTER TABLE webcal_user_layers MODIFY cal_dups ENUM('N','Y') DEFAULT 'N' COMMENT 'Show duplicates? (Y or N)';
ALTER TABLE webcal_user_layers MODIFY cal_color varchar(25) DEFAULT NULL COMMENT 'Color (preferably in hex) of this layer.' FIRST;
ALTER TABLE webcal_user_layers MODIFY cal_layeruser varchar(25) NOT NULL COMMENT 'Login name of user that this layer represents. Also from <a href="webcal_user">webcal_user</a> table.' FIRST;
ALTER TABLE webcal_user_layers MODIFY cal_login varchar(25) NOT NULL COMMENT 'Login of owner of this layer from <a href="webcal_user">webcal_user</a> table.' FIRST;

/*Consolodate some fields / tables into webcal_user_pref.*/
DELETE FROM webcal_config WHERE cal_value IS NULL;
DELETE FROM webcal_user_pref WHERE cal_value IS NULL;

ALTER TABLE webcal_user_pref DROP PRIMARY KEY;
ALTER TABLE webcal_user_pref ENGINE MyISAM CHARACTER SET utf8 COMMENT 'Specify preferences for a user. Most preferences are set via pref.php. Values in this table are loaded after system settings found in <a href="#webcal_config">webcal_config</a> table.';
ALTER TABLE webcal_user_pref MODIFY cal_value varchar(100) NOT NULL COMMENT 'Value of setting.';
ALTER TABLE webcal_user_pref ADD PRIMARY KEY (cal_login,cal_setting,cal_value);

ALTER TABLE webcal_user_pref MODIFY cal_login varchar(25) DEFAULT '__webcal__sys__';
INSERT INTO webcal_user_pref (cal_setting, cal_value) SELECT cal_setting, cal_value FROM webcal_config;

ALTER TABLE webcal_user_pref MODIFY cal_setting varchar(50) DEFAULT 'ACCESS_FUNCTIONS' FIRST;
ALTER TABLE webcal_user_pref MODIFY cal_login varchar(25) NOT NULL COMMENT 'User login from <a href="#webcal_user">webcal_user</a> table.' FIRST;
INSERT INTO webcal_user_pref (cal_login, cal_value) SELECT cal_login, cal_permissions FROM webcal_access_function;

ALTER TABLE webcal_user_pref MODIFY cal_setting varchar(50) DEFAULT 'ASSISTANT';
INSERT INTO webcal_user_pref (cal_login, cal_value) SELECT cal_boss, cal_assistant FROM webcal_asst;

ALTER TABLE webcal_user_pref MODIFY cal_setting varchar(50) DEFAULT 'GROUP_ID';
INSERT INTO webcal_user_pref (cal_login, cal_value) SELECT cal_login, cal_group_id FROM webcal_group_user;

ALTER TABLE webcal_user_pref MODIFY cal_setting varchar(50) DEFAULT 'ADDRESS';
INSERT INTO webcal_user_pref (cal_login, cal_value) SELECT cal_login, cal_address FROM webcal_user WHERE cal_address IS NOT NULL;

ALTER TABLE webcal_user_pref MODIFY cal_setting varchar(50) DEFAULT 'BIRTHDAY';
INSERT INTO webcal_user_pref (cal_login, cal_value) SELECT cal_login, cal_birthday FROM webcal_user WHERE cal_birthday IS NOT NULL;

ALTER TABLE webcal_user_pref MODIFY cal_setting varchar(50) DEFAULT 'DISPLAY_NAME';
UPDATE webcal_user_pref SET cal_firstname = '' WHERE cal_firstname IS NULL;
UPDATE webcal_user_pref SET cal_lastname = '' WHERE cal_lastname IS NULL;
INSERT INTO webcal_user_pref (cal_login, cal_value) SELECT cal_login, TRIM( CONCAT_WS( ' ',cal_firstname,cal_lastname ) ) FROM webcal_user;

ALTER TABLE webcal_user_pref MODIFY cal_setting varchar(50) DEFAULT 'EMAIL';
INSERT INTO webcal_user_pref (cal_login, cal_value) SELECT cal_login, cal_email FROM webcal_user WHERE cal_email IS NOT NULL;

ALTER TABLE webcal_user_pref MODIFY cal_setting varchar(50) DEFAULT 'FIRSTNAME';
INSERT INTO webcal_user_pref (cal_login, cal_value) SELECT cal_login, cal_firstname FROM webcal_user;

ALTER TABLE webcal_user_pref MODIFY cal_setting varchar(50) DEFAULT 'LASTNAME';
INSERT INTO webcal_user_pref (cal_login, cal_value) SELECT cal_login, cal_lastname FROM webcal_user;

ALTER TABLE webcal_user_pref MODIFY cal_setting varchar(50) DEFAULT 'PHONE';
INSERT INTO webcal_user_pref (cal_login, cal_value) SELECT cal_login, cal_telephone FROM webcal_user WHERE cal_telephone IS NOT NULL;

ALTER TABLE webcal_user_pref MODIFY cal_setting varchar(50) DEFAULT 'TITLE';
INSERT INTO webcal_user_pref (cal_login, cal_value) SELECT cal_login, cal_title FROM webcal_user WHERE cal_title IS NOT NULL;

ALTER TABLE webcal_user_pref MODIFY cal_setting varchar(50) DEFAULT 'VIEW_ID';
INSERT INTO webcal_user_pref (cal_login, cal_value) SELECT cal_login, cal_view_id FROM webcal_view_user;

ALTER TABLE webcal_user_pref MODIFY cal_setting varchar(50) NOT NULL COMMENT 'Setting name.';

/* Once the code gets updated, drop the obsolete fields / tables. */
/* End consolidating webcal_user_pref */

UPDATE webcal_user_template SET cal_login = '__webcal__sys__' WHERE cal_login = '__system_';
ALTER TABLE webcal_user_template ENGINE MyISAM CHARACTER SET utf8 COMMENT 'This table stores the custom header/stylesheet/trailer. If configured properly, each user (or nonuser cal) can have their own custom header/trailer.';
ALTER TABLE webcal_user_template MODIFY cal_type ENUM('H','S','T') NOT NULL COMMENT 'H)eader, S)tylesheet/script, T)railer.' FIRST;
ALTER TABLE webcal_user_template MODIFY cal_template_text text COMMENT 'Text of template.';
ALTER TABLE webcal_user_template MODIFY cal_login varchar(25) NOT NULL COMMENT 'User login (or nonuser cal name), the default for all users is stored with the username "__webcal__sys__".' FIRST;

ALTER TABLE webcal_view ENGINE MyISAM CHARACTER SET utf8 COMMENT 'A "view" allows a user to put the calendars of multiple users all on one page. A "view" is valid only for the owner (cal_owner) of the view. Users for the view are in <a href="#webcal_view_user">webcal_view_user</a> table.';
ALTER TABLE webcal_view MODIFY cal_view_type ENUM('D','M','W') DEFAULT NULL COMMENT '"W" for week view, "D" for day view, "M" for month view.';
ALTER TABLE webcal_view MODIFY cal_owner varchar(25) NOT NULL COMMENT 'Login name of owner of this view. From <a href="#webcal_user">webcal_user</a> table.' FIRST;
ALTER TABLE webcal_view MODIFY cal_name varchar(50) NOT NULL COMMENT 'Name of view.' FIRST;
ALTER TABLE webcal_view MODIFY cal_is_global ENUM('N','Y') NOT NULL DEFAULT 'N' COMMENT 'Is this a global view? (can it be accessed by other users - "Y" or "N")' FIRST;
ALTER TABLE webcal_view MODIFY cal_view_id int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Unique view id.' FIRST;

ALTER TABLE webcal_view_user ENGINE MyISAM CHARACTER SET utf8 COMMENT 'Specify users in a view.';
ALTER TABLE webcal_view_user MODIFY cal_login varchar(25) NOT NULL COMMENT 'A user in the view. From <a href="#webcal_user">webcal_user</a> table.';
ALTER TABLE webcal_view_user MODIFY cal_view_id int UNSIGNED NOT NULL COMMENT 'view id from <a href="#webcal_view">webcal_view</a> table.' FIRST;
    


After you complete manually updating your database, you will still need to run the installation script to perform any necessary data changes needed to convert existing data. Although, I've tried to do that for you in upgrading from 1.1.3, I may have missed something.


Valid HTML5!