Viewing File: /usr/local/cpanel/base/3rdparty/roundcube/plugins/calendar/drivers/ical/SQL/sqlite.initial.sql

/**
 * iCAL Client
 *
 * @version @package_version@
 * @author Daniel Morlock <daniel.morlock@awesome-it.de>
 *
 * Copyright (C) Awesome IT GbR <info@awesome-it.de>
 * Adapted for SQLite for cPanel, L.L.C. <cpanel.net> in 2019
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

CREATE TABLE IF NOT EXISTS ical_calendars (
  calendar_id integer NOT NULL PRIMARY KEY,
  user_id integer NOT NULL DEFAULT '0',
  name varchar(255) NOT NULL,
  color varchar(8) NOT NULL,
  showalarms tinyint(1) NOT NULL DEFAULT '1',

  ical_url varchar(255) NOT NULL,
  ical_user varchar(255) DEFAULT NULL,
  ical_pass varchar(1024) DEFAULT NULL,

  ical_last_change timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  CONSTRAINT fk_ical_calendars_user_id FOREIGN KEY (user_id)
    REFERENCES users(user_id)
);

CREATE INDEX ical_user_name_idx ON ical_calendars(user_id, name);

CREATE TRIGGER [UpdateLastTimeForiCalCalendar]
AFTER UPDATE
ON ical_calendars
FOR EACH ROW
BEGIN
UPDATE ical_calendars SET ical_last_change_timestamp = CURRENT_TIMESTAMP WHERE calendar_id = old.calendar_id;
END

CREATE TABLE ical_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,

  ical_url varchar(255) NOT NULL,
  ical_last_change timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,

  CONSTRAINT fk_ical_events_calendar_id FOREIGN KEY (calendar_id)
    REFERENCES ical_calendars(calendar_id)
);

CREATE INDEX ical_uid_idx ON caldav_events(uid);
CREATE INDEX ical_recurrence_idx ON caldav_events(recurrence_id);
CREATE INDEX ical_calendar_notify_idx ON caldav_events(calendar_id,notifyat);

CREATE TRIGGER [UpdateLastTimeForiCalEvents]
AFTER UPDATE
ON ical_events
FOR EACH ROW
BEGIN
UPDATE ical_events SET ical_last_change_timestamp = CURRENT_TIMESTAMP WHERE event_id = old.event_id;
END

CREATE TABLE IF NOT EXISTS ical_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 longtext NOT NULL,
  CONSTRAINT fk_ical_attachments_event_id FOREIGN KEY (event_id)
    REFERENCES ical_events(event_id)
);

REPLACE INTO system (name, value) VALUES ('calendar-ical-version', '2015022700');
Back to Directory File Manager