Updated database definitions. Should fix #559 for good.

This commit is contained in:
Evert Pot 2016-08-19 08:58:24 -04:00
parent ceb107e88f
commit 6e311126dd
2 changed files with 50 additions and 52 deletions

View file

@ -51,7 +51,7 @@ CREATE TABLE calendars (
calendarorder INT(11) UNSIGNED NOT NULL DEFAULT '0', calendarorder INT(11) UNSIGNED NOT NULL DEFAULT '0',
calendarcolor VARBINARY(10), calendarcolor VARBINARY(10),
timezone TEXT, timezone TEXT,
components VARBINARY(20), components VARBINARY(21),
transparent TINYINT(1) NOT NULL DEFAULT '0', transparent TINYINT(1) NOT NULL DEFAULT '0',
UNIQUE(principaluri, uri) UNIQUE(principaluri, uri)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

View file

@ -1,39 +1,39 @@
CREATE TABLE addressbooks ( CREATE TABLE addressbooks (
id integer primary key asc, id integer primary key asc NOT NULL,
principaluri text, principaluri text NOT NULL,
displayname text, displayname text,
uri text, uri text NOT NULL,
description text, description text,
synctoken integer synctoken integer DEFAULT 1 NOT NULL
); );
CREATE TABLE cards ( CREATE TABLE cards (
id integer primary key asc, id integer primary key asc NOT NULL,
addressbookid integer, addressbookid integer NOT NULL,
carddata blob, carddata blob,
uri text, uri text NOT NULL,
lastmodified integer, lastmodified integer,
etag text, etag text,
size integer size integer
); );
CREATE TABLE addressbookchanges ( CREATE TABLE addressbookchanges (
id integer primary key asc, id integer primary key asc NOT NULL,
uri text, uri text,
synctoken integer, synctoken integer NOT NULL,
addressbookid integer, addressbookid integer NOT NULL,
operation integer operation integer NOT NULL
); );
CREATE INDEX addressbookid_synctoken ON addressbookchanges (addressbookid, synctoken); CREATE INDEX addressbookid_synctoken ON addressbookchanges (addressbookid, synctoken);
CREATE TABLE calendarobjects ( CREATE TABLE calendarobjects (
id integer primary key asc, id integer primary key asc NOT NULL,
calendardata blob, calendardata blob NOT NULL,
uri text, uri text NOT NULL,
calendarid integer, calendarid integer NOT NULL,
lastmodified integer, lastmodified integer NOT NULL,
etag text, etag text NOT NULL,
size integer, size integer NOT NULL,
componenttype text, componenttype text,
firstoccurence integer, firstoccurence integer,
lastoccurence integer, lastoccurence integer,
@ -41,34 +41,34 @@ CREATE TABLE calendarobjects (
); );
CREATE TABLE calendars ( CREATE TABLE calendars (
id integer primary key asc, id integer primary key asc NOT NULL,
principaluri text, principaluri text NOT NULL,
displayname text, displayname text,
uri text, uri text NOT NULL,
synctoken integer, synctoken integer DEFAULT 1 NOT NULL,
description text, description text,
calendarorder integer, calendarorder integer,
calendarcolor text, calendarcolor text,
timezone text, timezone text,
components text, components text NOT NULL,
transparent bool transparent bool
); );
CREATE TABLE calendarchanges ( CREATE TABLE calendarchanges (
id integer primary key asc, id integer primary key asc NOT NULL,
uri text, uri text,
synctoken integer, synctoken integer NOT NULL,
calendarid integer, calendarid integer NOT NULL,
operation integer operation integer NOT NULL
); );
CREATE INDEX calendarid_synctoken ON calendarchanges (calendarid, synctoken); CREATE INDEX calendarid_synctoken ON calendarchanges (calendarid, synctoken);
CREATE TABLE calendarsubscriptions ( CREATE TABLE calendarsubscriptions (
id integer primary key asc, id integer primary key asc NOT NULL,
uri text, uri text NOT NULL,
principaluri text, principaluri text NOT NULL,
source text, source text NOT NULL,
displayname text, displayname text,
refreshrate text, refreshrate text,
calendarorder integer, calendarorder integer,
@ -80,19 +80,19 @@ CREATE TABLE calendarsubscriptions (
); );
CREATE TABLE schedulingobjects ( CREATE TABLE schedulingobjects (
id integer primary key asc, id integer primary key asc NOT NULL,
principaluri text, principaluri text NOT NULL,
calendardata blob, calendardata blob,
uri text, uri text NOT NULL,
lastmodified integer, lastmodified integer,
etag text, etag text NOT NULL,
size integer size integer NOT NULL
); );
CREATE INDEX principaluri_uri ON calendarsubscriptions (principaluri, uri); CREATE INDEX principaluri_uri ON calendarsubscriptions (principaluri, uri);
BEGIN TRANSACTION; BEGIN TRANSACTION;
CREATE TABLE locks ( CREATE TABLE locks (
id integer primary key asc, id integer primary key asc NOT NULL,
owner text, owner text,
timeout integer, timeout integer,
created integer, created integer,
@ -103,35 +103,33 @@ CREATE TABLE locks (
); );
COMMIT; COMMIT;
CREATE TABLE principals ( CREATE TABLE principals (
id INTEGER PRIMARY KEY ASC, id INTEGER PRIMARY KEY ASC NOT NULL,
uri TEXT, uri TEXT NOT NULL,
email TEXT, email TEXT,
displayname TEXT, displayname TEXT,
UNIQUE(uri) UNIQUE(uri)
); );
CREATE TABLE groupmembers ( CREATE TABLE groupmembers (
id INTEGER PRIMARY KEY ASC, id INTEGER PRIMARY KEY ASC NOT NULL,
principal_id INTEGER, principal_id INTEGER NOT NULL,
member_id INTEGER, member_id INTEGER NOT NULL,
UNIQUE(principal_id, member_id) UNIQUE(principal_id, member_id)
); );
CREATE TABLE propertystorage ( CREATE TABLE propertystorage (
id integer primary key asc, id integer primary key asc NOT NULL,
path text, path text NOT NULL,
name text, name text NOT NULL,
valuetype integer, valuetype integer NOT NULL,
value string value string
); );
CREATE UNIQUE INDEX path_property ON propertystorage (path, name); CREATE UNIQUE INDEX path_property ON propertystorage (path, name);
CREATE TABLE users ( CREATE TABLE users (
id integer primary key asc, id integer primary key asc NOT NULL,
username TEXT, username TEXT NOT NULL,
digesta1 TEXT, digesta1 TEXT NOT NULL,
UNIQUE(username) UNIQUE(username)
); );