diff options
author | Daniel Lange <DLange@git.local> | 2016-03-07 15:53:16 +0100 |
---|---|---|
committer | Daniel Lange <DLange@git.local> | 2016-03-07 15:53:16 +0100 |
commit | 50569114acdc64e7c7cae1498635d3f821517c30 (patch) | |
tree | 13d6fe76af33134fbfb2286930fb6603047f9299 /calendar/drivers/database/SQL | |
parent | c210d30de6c62e7f7867bb32651349ddf455d9e6 (diff) | |
download | roundcube_calendar-50569114acdc64e7c7cae1498635d3f821517c30.tar.gz roundcube_calendar-50569114acdc64e7c7cae1498635d3f821517c30.tar.bz2 roundcube_calendar-50569114acdc64e7c7cae1498635d3f821517c30.zip |
Initial commit of the Faster IT roundcube_calendar plugin distribution
This includes:
* Kolab plugins 3.2.9 (calendar and libcalendaring)
* CalDAV driver 3.2.8
* .htaccess files for at least some security
* SabreDAV updated to 1.8.12 (Jan 2015 release)
* Support for CURLOPT_SSL_* settings to allow self-signed certificates
* Small fixes & improved documentation
Diffstat (limited to 'calendar/drivers/database/SQL')
20 files changed, 537 insertions, 0 deletions
diff --git a/calendar/drivers/database/SQL/mysql.initial.sql b/calendar/drivers/database/SQL/mysql.initial.sql new file mode 100644 index 0000000..5f6dd60 --- /dev/null +++ b/calendar/drivers/database/SQL/mysql.initial.sql @@ -0,0 +1,85 @@ +/** + * Roundcube Calendar + * + * Plugin to add a calendar to Roundcube. + * + * @author Lazlo Westerhof + * @author Thomas Bruederli + * @licence GNU AGPL + * @copyright (c) 2010 Lazlo Westerhof - Netherlands + * @copyright (c) 2014 Kolab Systems AG + * + **/ + +CREATE TABLE IF NOT EXISTS `calendars` ( + `calendar_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, + `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0', + `name` varchar(255) NOT NULL, + `color` varchar(8) NOT NULL, + `showalarms` tinyint(1) NOT NULL DEFAULT '1', + PRIMARY KEY(`calendar_id`), + INDEX `user_name_idx` (`user_id`, `name`), + CONSTRAINT `fk_calendars_user_id` FOREIGN KEY (`user_id`) + REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE +) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */; + +CREATE TABLE IF NOT EXISTS `events` ( + `event_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, + `calendar_id` int(11) UNSIGNED NOT NULL DEFAULT '0', + `recurrence_id` int(11) UNSIGNED NOT NULL DEFAULT '0', + `uid` varchar(255) NOT NULL DEFAULT '', + `instance` varchar(16) NOT NULL DEFAULT '', + `isexception` tinyint(1) NOT NULL DEFAULT '0', + `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', + `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', + `sequence` int(1) UNSIGNED NOT NULL DEFAULT '0', + `start` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', + `end` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', + `recurrence` varchar(255) DEFAULT NULL, + `title` varchar(255) NOT NULL, + `description` text NOT NULL, + `location` varchar(255) NOT NULL DEFAULT '', + `categories` varchar(255) NOT NULL DEFAULT '', + `url` varchar(255) NOT NULL DEFAULT '', + `all_day` tinyint(1) NOT NULL DEFAULT '0', + `free_busy` tinyint(1) NOT NULL DEFAULT '0', + `priority` tinyint(1) NOT NULL DEFAULT '0', + `sensitivity` tinyint(1) NOT NULL DEFAULT '0', + `status` varchar(32) NOT NULL DEFAULT '', + `alarms` text DEFAULT NULL, + `attendees` text DEFAULT NULL, + `notifyat` datetime DEFAULT NULL, + PRIMARY KEY(`event_id`), + INDEX `uid_idx` (`uid`), + INDEX `recurrence_idx` (`recurrence_id`), + INDEX `calendar_notify_idx` (`calendar_id`,`notifyat`), + CONSTRAINT `fk_events_calendar_id` FOREIGN KEY (`calendar_id`) + REFERENCES `calendars`(`calendar_id`) ON DELETE CASCADE ON UPDATE CASCADE +) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */; + +CREATE TABLE IF NOT EXISTS `attachments` ( + `attachment_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, + `event_id` int(11) UNSIGNED NOT NULL DEFAULT '0', + `filename` varchar(255) NOT NULL DEFAULT '', + `mimetype` varchar(255) NOT NULL DEFAULT '', + `size` int(11) NOT NULL DEFAULT '0', + `data` longtext NOT NULL, + PRIMARY KEY(`attachment_id`), + CONSTRAINT `fk_attachments_event_id` FOREIGN KEY (`event_id`) + REFERENCES `events`(`event_id`) ON DELETE CASCADE ON UPDATE CASCADE +) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */; + +CREATE TABLE IF NOT EXISTS `itipinvitations` ( + `token` VARCHAR(64) NOT NULL, + `event_uid` VARCHAR(255) NOT NULL, + `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0', + `event` TEXT NOT NULL, + `expires` DATETIME DEFAULT NULL, + `cancelled` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY(`token`), + INDEX `uid_idx` (`user_id`,`event_uid`), + CONSTRAINT `fk_itipinvitations_user_id` FOREIGN KEY (`user_id`) + REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE +) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */; + +REPLACE INTO system (name, value) VALUES ('calendar-database-version', '2015022700'); diff --git a/calendar/drivers/database/SQL/mysql/2012080600.sql b/calendar/drivers/database/SQL/mysql/2012080600.sql new file mode 100644 index 0000000..f38e1cf --- /dev/null +++ b/calendar/drivers/database/SQL/mysql/2012080600.sql @@ -0,0 +1,3 @@ +-- MySQL database updates since version 0.7/0.8 + +ALTER TABLE `events` ADD `sequence` int(1) UNSIGNED NOT NULL DEFAULT '0' AFTER `changed`; diff --git a/calendar/drivers/database/SQL/mysql/2013011000.sql b/calendar/drivers/database/SQL/mysql/2013011000.sql new file mode 100644 index 0000000..fe6741a --- /dev/null +++ b/calendar/drivers/database/SQL/mysql/2013011000.sql @@ -0,0 +1 @@ +-- empty
\ No newline at end of file diff --git a/calendar/drivers/database/SQL/mysql/2013042700.sql b/calendar/drivers/database/SQL/mysql/2013042700.sql new file mode 100644 index 0000000..fe6741a --- /dev/null +++ b/calendar/drivers/database/SQL/mysql/2013042700.sql @@ -0,0 +1 @@ +-- empty
\ No newline at end of file diff --git a/calendar/drivers/database/SQL/mysql/2013051600.sql b/calendar/drivers/database/SQL/mysql/2013051600.sql new file mode 100644 index 0000000..4de44d6 --- /dev/null +++ b/calendar/drivers/database/SQL/mysql/2013051600.sql @@ -0,0 +1,3 @@ +-- MySQL database updates since version 0.9-beta + +ALTER TABLE `events` ADD `url` VARCHAR(255) NOT NULL AFTER `categories`;
\ No newline at end of file diff --git a/calendar/drivers/database/SQL/mysql/2014040900.sql b/calendar/drivers/database/SQL/mysql/2014040900.sql new file mode 100644 index 0000000..814e10d --- /dev/null +++ b/calendar/drivers/database/SQL/mysql/2014040900.sql @@ -0,0 +1,3 @@ +-- MySQL database updates since version 1.0 + +ALTER TABLE `events` ADD `status` VARCHAR(32) NOT NULL AFTER `sensitivity`; diff --git a/calendar/drivers/database/SQL/mysql/2015022700.sql b/calendar/drivers/database/SQL/mysql/2015022700.sql new file mode 100644 index 0000000..06d30fe --- /dev/null +++ b/calendar/drivers/database/SQL/mysql/2015022700.sql @@ -0,0 +1,15 @@ +-- add identifier for recurring instances and exceptions + +ALTER TABLE `events` ADD `instance` varchar(16) NOT NULL DEFAULT '' AFTER `uid`; +ALTER TABLE `events` ADD `isexception` tinyint(1) NOT NULL DEFAULT '0' AFTER `instance`; + +UPDATE `events` SET `instance` = DATE_FORMAT(`start`, '%Y%m%d') + WHERE `recurrence_id` != 0 AND `instance` = '' AND `all_day` = 1; + +UPDATE `events` SET `instance` = DATE_FORMAT(`start`, '%Y%m%dT%k%i%s') + WHERE `recurrence_id` != 0 AND `instance` = '' AND `all_day` = 0; + +-- extend alarms columns for multiple values + +ALTER TABLE `events` CHANGE `alarms` `alarms` TEXT NULL DEFAULT NULL; + diff --git a/calendar/drivers/database/SQL/postgres.initial.sql b/calendar/drivers/database/SQL/postgres.initial.sql new file mode 100644 index 0000000..b170086 --- /dev/null +++ b/calendar/drivers/database/SQL/postgres.initial.sql @@ -0,0 +1,109 @@ +/** + * RoundCube Calendar + * + * Plugin to add a calendar to RoundCube. + * + * @author Lazlo Westerhof + * @author Albert Lee + * @author Aleksander Machniak <machniak@kolabsys.com> + * @licence GNU AGPL + * @copyright (c) 2010 Lazlo Westerhof - Netherlands + * @copyright (c) 2014 Kolab Systems AG + * + **/ + + +CREATE SEQUENCE calendars_seq + INCREMENT BY 1 + NO MAXVALUE + NO MINVALUE + CACHE 1; + +CREATE TABLE calendars ( + calendar_id integer DEFAULT nextval('calendars_seq'::regclass) NOT NULL, + user_id integer NOT NULL + REFERENCES users (user_id) ON UPDATE CASCADE ON DELETE CASCADE, + name varchar(255) NOT NULL, + color varchar(8) NOT NULL, + showalarms smallint NOT NULL DEFAULT 1, + PRIMARY KEY (calendar_id) +); + +CREATE INDEX calendars_user_id_idx ON calendars (user_id, name); + + +CREATE SEQUENCE events_seq + INCREMENT BY 1 + NO MAXVALUE + NO MINVALUE + CACHE 1; + +CREATE TABLE events ( + event_id integer DEFAULT nextval('events_seq'::regclass) NOT NULL, + calendar_id integer NOT NULL + REFERENCES calendars (calendar_id) ON UPDATE CASCADE ON DELETE CASCADE, + recurrence_id integer NOT NULL DEFAULT 0, + uid varchar(255) NOT NULL DEFAULT '', + instance varchar(16) NOT NULL DEFAULT '', + isexception smallint NOT NULL DEFAULT '0', + created timestamp without time zone DEFAULT now() NOT NULL, + changed timestamp without time zone DEFAULT now(), + sequence integer NOT NULL DEFAULT 0, + "start" timestamp without time zone DEFAULT now() NOT NULL, + "end" timestamp without time zone DEFAULT now() NOT NULL, + recurrence varchar(255) DEFAULT NULL, + title character varying(255) NOT NULL DEFAULT '', + description text NOT NULL DEFAULT '', + location character varying(255) NOT NULL DEFAULT '', + categories character varying(255) NOT NULL DEFAULT '', + url character varying(255) NOT NULL DEFAULT '', + all_day smallint NOT NULL DEFAULT 0, + free_busy smallint NOT NULL DEFAULT 0, + priority smallint NOT NULL DEFAULT 0, + sensitivity smallint NOT NULL DEFAULT 0, + status character varying(32) NOT NULL DEFAULT '', + alarms text DEFAULT NULL, + attendees text DEFAULT NULL, + notifyat timestamp without time zone DEFAULT NULL, + PRIMARY KEY (event_id) +); + +CREATE INDEX events_calendar_id_notifyat_idx ON events (calendar_id, notifyat); +CREATE INDEX events_uid_idx ON events (uid); +CREATE INDEX events_recurrence_id_idx ON events (recurrence_id); + + +CREATE SEQUENCE attachments_seq + INCREMENT BY 1 + NO MAXVALUE + NO MINVALUE + CACHE 1; + +CREATE TABLE attachments ( + attachment_id integer DEFAULT nextval('attachments_seq'::regclass) NOT NULL, + event_id integer NOT NULL + REFERENCES events (event_id) ON DELETE CASCADE ON UPDATE CASCADE, + filename varchar(255) NOT NULL DEFAULT '', + mimetype varchar(255) NOT NULL DEFAULT '', + size integer NOT NULL DEFAULT 0, + data text NOT NULL DEFAULT '', + PRIMARY KEY (attachment_id) +); + +CREATE INDEX attachments_user_id_idx ON attachments (event_id); + + +CREATE TABLE itipinvitations ( + token varchar(64) NOT NULL, + event_uid varchar(255) NOT NULL, + user_id integer NOT NULL + REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE, + event TEXT NOT NULL, + expires timestamp without time zone DEFAULT NULL, + cancelled smallint NOT NULL DEFAULT 0, + PRIMARY KEY (token) +); + +CREATE INDEX itipinvitations_user_id_event_uid_idx ON itipinvitations (user_id, event_uid); + +INSERT INTO system (name, value) VALUES ('calendar-database-version', '2015022700'); diff --git a/calendar/drivers/database/SQL/postgres/2012080600.sql b/calendar/drivers/database/SQL/postgres/2012080600.sql new file mode 100644 index 0000000..9a273e6 --- /dev/null +++ b/calendar/drivers/database/SQL/postgres/2012080600.sql @@ -0,0 +1,3 @@ +-- Postgres database updates since version 0.7/0.8 + +ALTER TABLE events ADD sequence integer NOT NULL DEFAULT 0; diff --git a/calendar/drivers/database/SQL/postgres/2013011000.sql b/calendar/drivers/database/SQL/postgres/2013011000.sql new file mode 100644 index 0000000..fe6741a --- /dev/null +++ b/calendar/drivers/database/SQL/postgres/2013011000.sql @@ -0,0 +1 @@ +-- empty
\ No newline at end of file diff --git a/calendar/drivers/database/SQL/postgres/2013042700.sql b/calendar/drivers/database/SQL/postgres/2013042700.sql new file mode 100644 index 0000000..d644c39 --- /dev/null +++ b/calendar/drivers/database/SQL/postgres/2013042700.sql @@ -0,0 +1,8 @@ +ALTER SEQUENCE calendar_ids RENAME TO calendars_seq; +ALTER TABLE calendars ALTER COLUMN calendar_id SET DEFAULT nextval('calendars_seq'::text); + +ALTER SEQUENCE event_ids RENAME TO events_seq; +ALTER TABLE events ALTER COLUMN event_id SET DEFAULT nextval('events_seq'::text); + +ALTER SEQUENCE attachment_ids RENAME TO attachments_seq; +ALTER TABLE attachments ALTER COLUMN attachment_id SET DEFAULT nextval('attachments_seq'::text); diff --git a/calendar/drivers/database/SQL/postgres/2013051600.sql b/calendar/drivers/database/SQL/postgres/2013051600.sql new file mode 100644 index 0000000..3c1da43 --- /dev/null +++ b/calendar/drivers/database/SQL/postgres/2013051600.sql @@ -0,0 +1,3 @@ +-- Postgres database updates since version 0.9-beta + +ALTER TABLE events ADD url character varying(255) NOT NULL; diff --git a/calendar/drivers/database/SQL/postgres/2014040900.sql b/calendar/drivers/database/SQL/postgres/2014040900.sql new file mode 100644 index 0000000..310744c --- /dev/null +++ b/calendar/drivers/database/SQL/postgres/2014040900.sql @@ -0,0 +1,3 @@ +-- Postgres database updates since version 1.0 + +ALTER TABLE events ADD status character varying(32) NOT NULL; diff --git a/calendar/drivers/database/SQL/postgres/2015022700.sql b/calendar/drivers/database/SQL/postgres/2015022700.sql new file mode 100644 index 0000000..0de989e --- /dev/null +++ b/calendar/drivers/database/SQL/postgres/2015022700.sql @@ -0,0 +1,9 @@ +-- add identifier for recurring instances and exceptions + +ALTER TABLE events ADD instance character varying(16) NOT NULL; +ALTER TABLE events ADD isexception smallint NOT NULL DEFAULT '0'; + +-- extend alarms columns for multiple values + +ALTER TABLE events ALTER COLUMN alarms TYPE text; + diff --git a/calendar/drivers/database/SQL/sqlite.initial.sql b/calendar/drivers/database/SQL/sqlite.initial.sql new file mode 100644 index 0000000..c8aa971 --- /dev/null +++ b/calendar/drivers/database/SQL/sqlite.initial.sql @@ -0,0 +1,79 @@ +/** + * Roundcube Calendar + * + * Plugin to add a calendar to Roundcube. + * + * @author Lazlo Westerhof + * @author Thomas Bruederli + * @author Albert Lee + * @licence GNU AGPL + * @copyright (c) 2010 Lazlo Westerhof - Netherlands + * @copyright (c) 2014 Kolab Systems AG + * + **/ + +CREATE TABLE calendars ( + calendar_id integer NOT NULL PRIMARY KEY, + user_id integer NOT NULL default '0', + name varchar(255) NOT NULL default '', + color varchar(255) NOT NULL default '', + showalarms tinyint(1) NOT NULL default '1', + CONSTRAINT fk_calendars_user_id FOREIGN KEY (user_id) + REFERENCES users(user_id) +); + +CREATE TABLE events ( + event_id integer NOT NULL PRIMARY KEY, + calendar_id integer NOT NULL default '0', + recurrence_id integer NOT NULL default '0', + uid varchar(255) NOT NULL default '', + instance varchar(16) NOT NULL default '', + isexception tinyint(1) NOT NULL default '0', + created datetime NOT NULL default '1000-01-01 00:00:00', + changed datetime NOT NULL default '1000-01-01 00:00:00', + sequence integer NOT NULL default '0', + start datetime NOT NULL default '1000-01-01 00:00:00', + end datetime NOT NULL default '1000-01-01 00:00:00', + recurrence varchar(255) default NULL, + title varchar(255) NOT NULL, + description text NOT NULL, + location varchar(255) NOT NULL default '', + categories varchar(255) NOT NULL default '', + url varchar(255) NOT NULL default '', + all_day tinyint(1) NOT NULL default '0', + free_busy tinyint(1) NOT NULL default '0', + priority tinyint(1) NOT NULL default '0', + sensitivity tinyint(1) NOT NULL default '0', + status varchar(32) NOT NULL default '', + alarms text default NULL, + attendees text default NULL, + notifyat datetime default NULL, + CONSTRAINT fk_events_calendar_id FOREIGN KEY (calendar_id) + REFERENCES calendars(calendar_id) +); + +CREATE TABLE attachments ( + attachment_id integer NOT NULL PRIMARY KEY, + event_id integer NOT NULL default '0', + filename varchar(255) NOT NULL default '', + mimetype varchar(255) NOT NULL default '', + size integer NOT NULL default '0', + data text NOT NULL default '', + CONSTRAINT fk_attachment_event_id FOREIGN KEY (event_id) + REFERENCES events(event_id) +); + +CREATE TABLE itipinvitations ( + token varchar(64) NOT NULL PRIMARY KEY, + event_uid varchar(255) NOT NULL, + user_id integer NOT NULL default '0', + event text NOT NULL, + expires datetime NOT NULL default '1000-01-01 00:00:00', + cancelled tinyint(1) NOT NULL default '0', + CONSTRAINT fk_itipinvitations_user_id FOREIGN KEY (user_id) + REFERENCES users(user_id) +); + +CREATE INDEX ix_itipinvitations_uid ON itipinvitations(user_id, event_uid); + +INSERT INTO system (name, value) VALUES ('calendar-database-version', '2015022700'); diff --git a/calendar/drivers/database/SQL/sqlite/2013011000.sql b/calendar/drivers/database/SQL/sqlite/2013011000.sql new file mode 100644 index 0000000..fe6741a --- /dev/null +++ b/calendar/drivers/database/SQL/sqlite/2013011000.sql @@ -0,0 +1 @@ +-- empty
\ No newline at end of file diff --git a/calendar/drivers/database/SQL/sqlite/2013042700.sql b/calendar/drivers/database/SQL/sqlite/2013042700.sql new file mode 100644 index 0000000..fe6741a --- /dev/null +++ b/calendar/drivers/database/SQL/sqlite/2013042700.sql @@ -0,0 +1 @@ +-- empty
\ No newline at end of file diff --git a/calendar/drivers/database/SQL/sqlite/2013051600.sql b/calendar/drivers/database/SQL/sqlite/2013051600.sql new file mode 100644 index 0000000..850fae3 --- /dev/null +++ b/calendar/drivers/database/SQL/sqlite/2013051600.sql @@ -0,0 +1,63 @@ +-- SQLite database updates since version 0.9-beta + +-- ALTER TABLE events ADD url varchar(255) NOT NULL AFTER categories; + +CREATE TABLE temp_events ( + event_id integer NOT NULL PRIMARY KEY, + calendar_id integer NOT NULL default '0', + recurrence_id integer NOT NULL default '0', + uid varchar(255) NOT NULL default '', + created datetime NOT NULL default '1000-01-01 00:00:00', + changed datetime NOT NULL default '1000-01-01 00:00:00', + sequence integer NOT NULL default '0', + start datetime NOT NULL default '1000-01-01 00:00:00', + end datetime NOT NULL default '1000-01-01 00:00:00', + recurrence varchar(255) default NULL, + title varchar(255) NOT NULL, + description text NOT NULL, + location varchar(255) NOT NULL default '', + categories varchar(255) NOT NULL default '', + all_day tinyint(1) NOT NULL default '0', + free_busy tinyint(1) NOT NULL default '0', + priority tinyint(1) NOT NULL default '0', + sensitivity tinyint(1) NOT NULL default '0', + alarms varchar(255) default NULL, + attendees text default NULL, + notifyat datetime default NULL +); + +INSERT INTO temp_events (event_id, calendar_id, recurrence_id, uid, created, changed, sequence, start, end, recurrence, title, description, location, categories, all_day, free_busy, priority, sensitivity, alarms, attendees, notifyat) + SELECT event_id, calendar_id, recurrence_id, uid, created, changed, sequence, start, end, recurrence, title, description, location, categories, all_day, free_busy, priority, sensitivity, alarms, attendees, notifyat FROM events; + +DROP TABLE events; + +CREATE TABLE events ( + event_id integer NOT NULL PRIMARY KEY, + calendar_id integer NOT NULL default '0', + recurrence_id integer NOT NULL default '0', + uid varchar(255) NOT NULL default '', + created datetime NOT NULL default '1000-01-01 00:00:00', + changed datetime NOT NULL default '1000-01-01 00:00:00', + sequence integer NOT NULL default '0', + start datetime NOT NULL default '1000-01-01 00:00:00', + end datetime NOT NULL default '1000-01-01 00:00:00', + recurrence varchar(255) default NULL, + title varchar(255) NOT NULL, + description text NOT NULL, + location varchar(255) NOT NULL default '', + categories varchar(255) NOT NULL default '', + url varchar(255) NOT NULL default '', + all_day tinyint(1) NOT NULL default '0', + free_busy tinyint(1) NOT NULL default '0', + priority tinyint(1) NOT NULL default '0', + sensitivity tinyint(1) NOT NULL default '0', + alarms varchar(255) default NULL, + attendees text default NULL, + notifyat datetime default NULL, + CONSTRAINT fk_events_calendar_id FOREIGN KEY (calendar_id) + REFERENCES calendars(calendar_id) +); + +INSERT INTO events (event_id, calendar_id, recurrence_id, uid, created, changed, sequence, start, end, recurrence, title, description, location, categories, all_day, free_busy, priority, sensitivity, alarms, attendees, notifyat) + SELECT event_id, calendar_id, recurrence_id, uid, created, changed, sequence, start, end, recurrence, title, description, location, categories, all_day, free_busy, priority, sensitivity, alarms, attendees, notifyat FROM temp_events; + diff --git a/calendar/drivers/database/SQL/sqlite/2014040900.sql b/calendar/drivers/database/SQL/sqlite/2014040900.sql new file mode 100644 index 0000000..ff8ed17 --- /dev/null +++ b/calendar/drivers/database/SQL/sqlite/2014040900.sql @@ -0,0 +1,67 @@ +-- SQLite database updates since version 0.9-beta + +-- ALTER TABLE events ADD url varchar(255) NOT NULL AFTER categories; + +CREATE TABLE temp_events ( + event_id integer NOT NULL PRIMARY KEY, + calendar_id integer NOT NULL default '0', + recurrence_id integer NOT NULL default '0', + uid varchar(255) NOT NULL default '', + created datetime NOT NULL default '1000-01-01 00:00:00', + changed datetime NOT NULL default '1000-01-01 00:00:00', + sequence integer NOT NULL default '0', + start datetime NOT NULL default '1000-01-01 00:00:00', + end datetime NOT NULL default '1000-01-01 00:00:00', + recurrence varchar(255) default NULL, + title varchar(255) NOT NULL, + description text NOT NULL, + location varchar(255) NOT NULL default '', + categories varchar(255) NOT NULL default '', + url varchar(255) NOT NULL default '', + all_day tinyint(1) NOT NULL default '0', + free_busy tinyint(1) NOT NULL default '0', + priority tinyint(1) NOT NULL default '0', + sensitivity tinyint(1) NOT NULL default '0', + alarms varchar(255) default NULL, + attendees text default NULL, + notifyat datetime default NULL +); + +INSERT INTO temp_events (event_id, calendar_id, recurrence_id, uid, created, changed, sequence, start, end, recurrence, title, description, location, categories, url, all_day, free_busy, priority, sensitivity, alarms, attendees, notifyat) + SELECT event_id, calendar_id, recurrence_id, uid, created, changed, sequence, start, end, recurrence, title, description, location, categories, url, all_day, free_busy, priority, sensitivity, alarms, attendees, notifyat + FROM events; + +DROP TABLE events; + +CREATE TABLE events ( + event_id integer NOT NULL PRIMARY KEY, + calendar_id integer NOT NULL default '0', + recurrence_id integer NOT NULL default '0', + uid varchar(255) NOT NULL default '', + created datetime NOT NULL default '1000-01-01 00:00:00', + changed datetime NOT NULL default '1000-01-01 00:00:00', + sequence integer NOT NULL default '0', + start datetime NOT NULL default '1000-01-01 00:00:00', + end datetime NOT NULL default '1000-01-01 00:00:00', + recurrence varchar(255) default NULL, + title varchar(255) NOT NULL, + description text NOT NULL, + location varchar(255) NOT NULL default '', + categories varchar(255) NOT NULL default '', + url varchar(255) NOT NULL default '', + all_day tinyint(1) NOT NULL default '0', + free_busy tinyint(1) NOT NULL default '0', + priority tinyint(1) NOT NULL default '0', + sensitivity tinyint(1) NOT NULL default '0', + status varchar(32) NOT NULL default '', + alarms varchar(255) default NULL, + attendees text default NULL, + notifyat datetime default NULL, + CONSTRAINT fk_events_calendar_id FOREIGN KEY (calendar_id) + REFERENCES calendars(calendar_id) +); + +INSERT INTO events (event_id, calendar_id, recurrence_id, uid, created, changed, sequence, start, end, recurrence, title, description, location, categories, url, all_day, free_busy, priority, sensitivity, alarms, attendees, notifyat) + SELECT event_id, calendar_id, recurrence_id, uid, created, changed, sequence, start, end, recurrence, title, description, location, categories, url, all_day, free_busy, priority, sensitivity, alarms, attendees, notifyat + FROM temp_events; + diff --git a/calendar/drivers/database/SQL/sqlite/2015022700.sql b/calendar/drivers/database/SQL/sqlite/2015022700.sql new file mode 100644 index 0000000..9770701 --- /dev/null +++ b/calendar/drivers/database/SQL/sqlite/2015022700.sql @@ -0,0 +1,79 @@ +-- ALTER TABLE `events` ADD `instance` varchar(16) NOT NULL DEFAULT '' AFTER `uid`; +-- ALTER TABLE `events` ADD `isexception` tinyint(3) NOT NULL DEFAULT '0' AFTER `instance`; +-- ALTER TABLE `events` CHANGE `alarms` `alarms` TEXT NULL DEFAULT NULL; + +CREATE TABLE temp_events ( + event_id integer NOT NULL PRIMARY KEY, + calendar_id integer NOT NULL default '0', + recurrence_id integer NOT NULL default '0', + uid varchar(255) NOT NULL default '', + created datetime NOT NULL default '1000-01-01 00:00:00', + changed datetime NOT NULL default '1000-01-01 00:00:00', + sequence integer NOT NULL default '0', + start datetime NOT NULL default '1000-01-01 00:00:00', + end datetime NOT NULL default '1000-01-01 00:00:00', + recurrence varchar(255) default NULL, + title varchar(255) NOT NULL, + description text NOT NULL, + location varchar(255) NOT NULL default '', + categories varchar(255) NOT NULL default '', + url varchar(255) NOT NULL default '', + all_day tinyint(1) NOT NULL default '0', + free_busy tinyint(1) NOT NULL default '0', + priority tinyint(1) NOT NULL default '0', + sensitivity tinyint(1) NOT NULL default '0', + status varchar(32) NOT NULL default '', + alarms varchar(255) default NULL, + attendees text default NULL, + notifyat datetime default NULL +); + +INSERT INTO temp_events (event_id, calendar_id, recurrence_id, uid, created, changed, sequence, start, end, recurrence, title, description, location, categories, url, all_day, free_busy, priority, sensitivity, alarms, attendees, notifyat) + SELECT event_id, calendar_id, recurrence_id, uid, created, changed, sequence, start, end, recurrence, title, description, location, categories, url, all_day, free_busy, priority, sensitivity, alarms, attendees, notifyat + FROM events; + +DROP TABLE events; + +CREATE TABLE events ( + event_id integer NOT NULL PRIMARY KEY, + calendar_id integer NOT NULL default '0', + recurrence_id integer NOT NULL default '0', + uid varchar(255) NOT NULL default '', + instance varchar(16) NOT NULL default '', + isexception tinyint(1) NOT NULL default '0', + created datetime NOT NULL default '1000-01-01 00:00:00', + changed datetime NOT NULL default '1000-01-01 00:00:00', + sequence integer NOT NULL default '0', + start datetime NOT NULL default '1000-01-01 00:00:00', + end datetime NOT NULL default '1000-01-01 00:00:00', + recurrence varchar(255) default NULL, + title varchar(255) NOT NULL, + description text NOT NULL, + location varchar(255) NOT NULL default '', + categories varchar(255) NOT NULL default '', + url varchar(255) NOT NULL default '', + all_day tinyint(1) NOT NULL default '0', + free_busy tinyint(1) NOT NULL default '0', + priority tinyint(1) NOT NULL default '0', + sensitivity tinyint(1) NOT NULL default '0', + status varchar(32) NOT NULL default '', + alarms text default NULL, + attendees text default NULL, + notifyat datetime default NULL, + CONSTRAINT fk_events_calendar_id FOREIGN KEY (calendar_id) + REFERENCES calendars(calendar_id) +); + +INSERT INTO events (event_id, calendar_id, recurrence_id, uid, created, changed, sequence, start, end, recurrence, title, description, location, categories, url, all_day, free_busy, priority, sensitivity, alarms, attendees, notifyat) + SELECT event_id, calendar_id, recurrence_id, uid, created, changed, sequence, start, end, recurrence, title, description, location, categories, url, all_day, free_busy, priority, sensitivity, alarms, attendees, notifyat + FROM temp_events; + +DROP TABLE temp_events; + +-- Derrive instance columns from start date/time + +UPDATE events SET instance = strftime('%Y%m%d', start) + WHERE recurrence_id != 0 AND instance = '' AND all_day = 1; + +UPDATE events SET instance = strftime('%Y%m%dT%H%M%S', start) + WHERE recurrence_id != 0 AND instance = '' AND all_day = 0; |