From 6e311126dd31d918cf93c3095c74bdf786fb55b6 Mon Sep 17 00:00:00 2001 From: Evert Pot Date: Fri, 19 Aug 2016 08:58:24 -0400 Subject: [PATCH] Updated database definitions. Should fix #559 for good. --- Core/Resources/Db/MySQL/db.sql | 2 +- Core/Resources/Db/SQLite/db.sql | 100 ++++++++++++++++---------------- 2 files changed, 50 insertions(+), 52 deletions(-) diff --git a/Core/Resources/Db/MySQL/db.sql b/Core/Resources/Db/MySQL/db.sql index 68e128a..6dc4e23 100644 --- a/Core/Resources/Db/MySQL/db.sql +++ b/Core/Resources/Db/MySQL/db.sql @@ -51,7 +51,7 @@ CREATE TABLE calendars ( calendarorder INT(11) UNSIGNED NOT NULL DEFAULT '0', calendarcolor VARBINARY(10), timezone TEXT, - components VARBINARY(20), + components VARBINARY(21), transparent TINYINT(1) NOT NULL DEFAULT '0', UNIQUE(principaluri, uri) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; diff --git a/Core/Resources/Db/SQLite/db.sql b/Core/Resources/Db/SQLite/db.sql index de9dfe5..e8b8d55 100644 --- a/Core/Resources/Db/SQLite/db.sql +++ b/Core/Resources/Db/SQLite/db.sql @@ -1,39 +1,39 @@ CREATE TABLE addressbooks ( - id integer primary key asc, - principaluri text, + id integer primary key asc NOT NULL, + principaluri text NOT NULL, displayname text, - uri text, + uri text NOT NULL, description text, - synctoken integer + synctoken integer DEFAULT 1 NOT NULL ); CREATE TABLE cards ( - id integer primary key asc, - addressbookid integer, + id integer primary key asc NOT NULL, + addressbookid integer NOT NULL, carddata blob, - uri text, + uri text NOT NULL, lastmodified integer, etag text, size integer ); CREATE TABLE addressbookchanges ( - id integer primary key asc, + id integer primary key asc NOT NULL, uri text, - synctoken integer, - addressbookid integer, - operation integer + synctoken integer NOT NULL, + addressbookid integer NOT NULL, + operation integer NOT NULL ); CREATE INDEX addressbookid_synctoken ON addressbookchanges (addressbookid, synctoken); CREATE TABLE calendarobjects ( - id integer primary key asc, - calendardata blob, - uri text, - calendarid integer, - lastmodified integer, - etag text, - size integer, + id integer primary key asc NOT NULL, + calendardata blob NOT NULL, + uri text NOT NULL, + calendarid integer NOT NULL, + lastmodified integer NOT NULL, + etag text NOT NULL, + size integer NOT NULL, componenttype text, firstoccurence integer, lastoccurence integer, @@ -41,34 +41,34 @@ CREATE TABLE calendarobjects ( ); CREATE TABLE calendars ( - id integer primary key asc, - principaluri text, + id integer primary key asc NOT NULL, + principaluri text NOT NULL, displayname text, - uri text, - synctoken integer, + uri text NOT NULL, + synctoken integer DEFAULT 1 NOT NULL, description text, calendarorder integer, calendarcolor text, timezone text, - components text, + components text NOT NULL, transparent bool ); CREATE TABLE calendarchanges ( - id integer primary key asc, + id integer primary key asc NOT NULL, uri text, - synctoken integer, - calendarid integer, - operation integer + synctoken integer NOT NULL, + calendarid integer NOT NULL, + operation integer NOT NULL ); CREATE INDEX calendarid_synctoken ON calendarchanges (calendarid, synctoken); CREATE TABLE calendarsubscriptions ( - id integer primary key asc, - uri text, - principaluri text, - source text, + id integer primary key asc NOT NULL, + uri text NOT NULL, + principaluri text NOT NULL, + source text NOT NULL, displayname text, refreshrate text, calendarorder integer, @@ -80,19 +80,19 @@ CREATE TABLE calendarsubscriptions ( ); CREATE TABLE schedulingobjects ( - id integer primary key asc, - principaluri text, + id integer primary key asc NOT NULL, + principaluri text NOT NULL, calendardata blob, - uri text, + uri text NOT NULL, lastmodified integer, - etag text, - size integer + etag text NOT NULL, + size integer NOT NULL ); CREATE INDEX principaluri_uri ON calendarsubscriptions (principaluri, uri); BEGIN TRANSACTION; CREATE TABLE locks ( - id integer primary key asc, + id integer primary key asc NOT NULL, owner text, timeout integer, created integer, @@ -103,35 +103,33 @@ CREATE TABLE locks ( ); COMMIT; CREATE TABLE principals ( - id INTEGER PRIMARY KEY ASC, - uri TEXT, + id INTEGER PRIMARY KEY ASC NOT NULL, + uri TEXT NOT NULL, email TEXT, displayname TEXT, UNIQUE(uri) ); CREATE TABLE groupmembers ( - id INTEGER PRIMARY KEY ASC, - principal_id INTEGER, - member_id INTEGER, + id INTEGER PRIMARY KEY ASC NOT NULL, + principal_id INTEGER NOT NULL, + member_id INTEGER NOT NULL, UNIQUE(principal_id, member_id) ); - CREATE TABLE propertystorage ( - id integer primary key asc, - path text, - name text, - valuetype integer, + id integer primary key asc NOT NULL, + path text NOT NULL, + name text NOT NULL, + valuetype integer NOT NULL, value string ); CREATE UNIQUE INDEX path_property ON propertystorage (path, name); CREATE TABLE users ( - id integer primary key asc, - username TEXT, - digesta1 TEXT, + id integer primary key asc NOT NULL, + username TEXT NOT NULL, + digesta1 TEXT NOT NULL, UNIQUE(username) ); -