Updated .sql files and provided a script to do this automatically.
This commit is contained in:
parent
31ff23db7d
commit
5b84396c13
3 changed files with 219 additions and 93 deletions
|
@ -1,89 +1,142 @@
|
|||
--
|
||||
-- This is the empty database schema for Baïkal
|
||||
-- Corresponds to the MySQL Schema definition of project SabreDAV 1.8.6
|
||||
-- http://code.google.com/p/sabredav/
|
||||
--
|
||||
CREATE TABLE addressbooks (
|
||||
id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
principaluri VARBINARY(255),
|
||||
displayname VARCHAR(255),
|
||||
uri VARBINARY(200),
|
||||
description TEXT,
|
||||
synctoken INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
||||
UNIQUE(principaluri(100), uri(100))
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
CREATE TABLE cards (
|
||||
id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
addressbookid INT(11) UNSIGNED NOT NULL,
|
||||
carddata MEDIUMBLOB,
|
||||
uri VARBINARY(200),
|
||||
lastmodified INT(11) UNSIGNED,
|
||||
etag VARBINARY(32),
|
||||
size INT(11) UNSIGNED NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE addressbookchanges (
|
||||
id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
uri VARBINARY(200) NOT NULL,
|
||||
synctoken INT(11) UNSIGNED NOT NULL,
|
||||
addressbookid INT(11) UNSIGNED NOT NULL,
|
||||
operation TINYINT(1) NOT NULL,
|
||||
INDEX addressbookid_synctoken (addressbookid, synctoken)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
CREATE TABLE calendarobjects (
|
||||
id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
calendardata MEDIUMBLOB,
|
||||
uri VARBINARY(200),
|
||||
calendarid INTEGER UNSIGNED NOT NULL,
|
||||
lastmodified INT(11) UNSIGNED,
|
||||
etag VARBINARY(32),
|
||||
size INT(11) UNSIGNED NOT NULL,
|
||||
componenttype VARBINARY(8),
|
||||
firstoccurence INT(11) UNSIGNED,
|
||||
lastoccurence INT(11) UNSIGNED,
|
||||
uid VARBINARY(200),
|
||||
UNIQUE(calendarid, uri)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE calendars (
|
||||
id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
username VARCHAR(50),
|
||||
digesta1 VARCHAR(32),
|
||||
UNIQUE(username)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
principaluri VARBINARY(100),
|
||||
displayname VARCHAR(100),
|
||||
uri VARBINARY(200),
|
||||
synctoken INTEGER UNSIGNED NOT NULL DEFAULT '1',
|
||||
description TEXT,
|
||||
calendarorder INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
calendarcolor VARBINARY(10),
|
||||
timezone TEXT,
|
||||
components VARBINARY(20),
|
||||
transparent TINYINT(1) NOT NULL DEFAULT '0',
|
||||
UNIQUE(principaluri, uri)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS principals (
|
||||
id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
uri VARCHAR(200) NOT NULL,
|
||||
email VARCHAR(80),
|
||||
displayname VARCHAR(80),
|
||||
vcardurl VARCHAR(255),
|
||||
UNIQUE(uri)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
CREATE TABLE calendarchanges (
|
||||
id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
uri VARBINARY(200) NOT NULL,
|
||||
synctoken INT(11) UNSIGNED NOT NULL,
|
||||
calendarid INT(11) UNSIGNED NOT NULL,
|
||||
operation TINYINT(1) NOT NULL,
|
||||
INDEX calendarid_synctoken (calendarid, synctoken)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS groupmembers (
|
||||
id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
principal_id INTEGER UNSIGNED NOT NULL,
|
||||
member_id INTEGER UNSIGNED NOT NULL,
|
||||
UNIQUE(principal_id, member_id)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
CREATE TABLE calendarsubscriptions (
|
||||
id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
uri VARBINARY(200) NOT NULL,
|
||||
principaluri VARBINARY(100) NOT NULL,
|
||||
source TEXT,
|
||||
displayname VARCHAR(100),
|
||||
refreshrate VARCHAR(10),
|
||||
calendarorder INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
calendarcolor VARBINARY(10),
|
||||
striptodos TINYINT(1) NULL,
|
||||
stripalarms TINYINT(1) NULL,
|
||||
stripattachments TINYINT(1) NULL,
|
||||
lastmodified INT(11) UNSIGNED,
|
||||
UNIQUE(principaluri, uri)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS locks (
|
||||
CREATE TABLE schedulingobjects (
|
||||
id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
principaluri VARBINARY(255),
|
||||
calendardata MEDIUMBLOB,
|
||||
uri VARBINARY(200),
|
||||
lastmodified INT(11) UNSIGNED,
|
||||
etag VARBINARY(32),
|
||||
size INT(11) UNSIGNED NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
CREATE TABLE locks (
|
||||
id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
owner VARCHAR(100),
|
||||
timeout INTEGER UNSIGNED,
|
||||
created INTEGER,
|
||||
token VARCHAR(100),
|
||||
token VARBINARY(100),
|
||||
scope TINYINT,
|
||||
depth TINYINT,
|
||||
uri VARCHAR(1000),
|
||||
uri VARBINARY(1000),
|
||||
INDEX(token),
|
||||
INDEX(uri(100))
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS calendarobjects (
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
CREATE TABLE principals (
|
||||
id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
calendardata MEDIUMBLOB,
|
||||
uri VARCHAR(200),
|
||||
calendarid INTEGER UNSIGNED NOT NULL,
|
||||
lastmodified INT(11) UNSIGNED,
|
||||
etag VARCHAR(32),
|
||||
size INT(11) UNSIGNED NOT NULL,
|
||||
componenttype VARCHAR(8),
|
||||
firstoccurence INT(11) UNSIGNED,
|
||||
lastoccurence INT(11) UNSIGNED,
|
||||
UNIQUE(calendarid, uri)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
uri VARBINARY(200) NOT NULL,
|
||||
email VARBINARY(80),
|
||||
displayname VARCHAR(80),
|
||||
UNIQUE(uri)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS calendars (
|
||||
CREATE TABLE groupmembers (
|
||||
id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
principaluri VARCHAR(100),
|
||||
displayname VARCHAR(100),
|
||||
uri VARCHAR(200),
|
||||
ctag INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
description TEXT,
|
||||
calendarorder INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
calendarcolor VARCHAR(10),
|
||||
timezone TEXT,
|
||||
components VARCHAR(21),
|
||||
transparent TINYINT(1) NOT NULL DEFAULT '0',
|
||||
UNIQUE(principaluri, uri)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
principal_id INTEGER UNSIGNED NOT NULL,
|
||||
member_id INTEGER UNSIGNED NOT NULL,
|
||||
UNIQUE(principal_id, member_id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS addressbooks (
|
||||
id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
principaluri VARCHAR(255),
|
||||
displayname VARCHAR(255),
|
||||
uri VARCHAR(200),
|
||||
description TEXT,
|
||||
ctag INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
||||
UNIQUE(principaluri, uri)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
INSERT INTO principals (uri,email,displayname) VALUES
|
||||
('principals/admin', 'admin@example.org','Administrator'),
|
||||
('principals/admin/calendar-proxy-read', null, null),
|
||||
('principals/admin/calendar-proxy-write', null, null);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS cards (
|
||||
id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
addressbookid INT(11) UNSIGNED NOT NULL,
|
||||
carddata MEDIUMBLOB,
|
||||
uri VARCHAR(200),
|
||||
lastmodified INT(11) UNSIGNED
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
CREATE TABLE propertystorage (
|
||||
id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
path VARBINARY(1024) NOT NULL,
|
||||
name VARBINARY(100) NOT NULL,
|
||||
valuetype INT UNSIGNED,
|
||||
value MEDIUMBLOB
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE UNIQUE INDEX path_property ON propertystorage (path(600), name(100));
|
||||
CREATE TABLE users (
|
||||
id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
username VARBINARY(50),
|
||||
digesta1 VARBINARY(32),
|
||||
UNIQUE(username)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
INSERT INTO users (username,digesta1) VALUES
|
||||
('admin', '87fd274b7b6c01e48d7c2f965da8ddf7');
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
--
|
||||
-- This is the empty database schema for Baïkal
|
||||
-- Corresponds to the MySQL Schema definition of project SabreDAV 1.8.6
|
||||
-- http://code.google.com/p/sabredav/
|
||||
--
|
||||
|
||||
CREATE TABLE addressbooks (
|
||||
id integer primary key asc,
|
||||
principaluri text,
|
||||
displayname text,
|
||||
uri text,
|
||||
description text,
|
||||
ctag integer
|
||||
synctoken integer
|
||||
);
|
||||
|
||||
CREATE TABLE cards (
|
||||
|
@ -18,9 +12,20 @@ CREATE TABLE cards (
|
|||
addressbookid integer,
|
||||
carddata blob,
|
||||
uri text,
|
||||
lastmodified integer
|
||||
lastmodified integer,
|
||||
etag text,
|
||||
size integer
|
||||
);
|
||||
|
||||
CREATE TABLE addressbookchanges (
|
||||
id integer primary key asc,
|
||||
uri text,
|
||||
synctoken integer,
|
||||
addressbookid integer,
|
||||
operation integer
|
||||
);
|
||||
|
||||
CREATE INDEX addressbookid_synctoken ON addressbookchanges (addressbookid, synctoken);
|
||||
CREATE TABLE calendarobjects (
|
||||
id integer primary key asc,
|
||||
calendardata blob,
|
||||
|
@ -31,7 +36,8 @@ CREATE TABLE calendarobjects (
|
|||
size integer,
|
||||
componenttype text,
|
||||
firstoccurence integer,
|
||||
lastoccurence integer
|
||||
lastoccurence integer,
|
||||
uid text
|
||||
);
|
||||
|
||||
CREATE TABLE calendars (
|
||||
|
@ -39,7 +45,7 @@ CREATE TABLE calendars (
|
|||
principaluri text,
|
||||
displayname text,
|
||||
uri text,
|
||||
ctag integer,
|
||||
synctoken integer,
|
||||
description text,
|
||||
calendarorder integer,
|
||||
calendarcolor text,
|
||||
|
@ -48,6 +54,43 @@ CREATE TABLE calendars (
|
|||
transparent bool
|
||||
);
|
||||
|
||||
CREATE TABLE calendarchanges (
|
||||
id integer primary key asc,
|
||||
uri text,
|
||||
synctoken integer,
|
||||
calendarid integer,
|
||||
operation integer
|
||||
);
|
||||
|
||||
CREATE INDEX calendarid_synctoken ON calendarchanges (calendarid, synctoken);
|
||||
|
||||
CREATE TABLE calendarsubscriptions (
|
||||
id integer primary key asc,
|
||||
uri text,
|
||||
principaluri text,
|
||||
source text,
|
||||
displayname text,
|
||||
refreshrate text,
|
||||
calendarorder integer,
|
||||
calendarcolor text,
|
||||
striptodos bool,
|
||||
stripalarms bool,
|
||||
stripattachments bool,
|
||||
lastmodified int
|
||||
);
|
||||
|
||||
CREATE TABLE schedulingobjects (
|
||||
id integer primary key asc,
|
||||
principaluri text,
|
||||
calendardata blob,
|
||||
uri text,
|
||||
lastmodified integer,
|
||||
etag text,
|
||||
size integer
|
||||
);
|
||||
|
||||
CREATE INDEX principaluri_uri ON calendarsubscriptions (principaluri, uri);
|
||||
BEGIN TRANSACTION;
|
||||
CREATE TABLE locks (
|
||||
id integer primary key asc,
|
||||
owner text,
|
||||
|
@ -58,13 +101,12 @@ CREATE TABLE locks (
|
|||
depth integer,
|
||||
uri text
|
||||
);
|
||||
|
||||
COMMIT;
|
||||
CREATE TABLE principals (
|
||||
id INTEGER PRIMARY KEY ASC,
|
||||
uri TEXT,
|
||||
email TEXT,
|
||||
displayname TEXT,
|
||||
vcardurl TEXT,
|
||||
UNIQUE(uri)
|
||||
);
|
||||
|
||||
|
@ -75,9 +117,27 @@ CREATE TABLE groupmembers (
|
|||
UNIQUE(principal_id, member_id)
|
||||
);
|
||||
|
||||
|
||||
INSERT INTO principals (uri,email,displayname) VALUES ('principals/admin', 'admin@example.org','Administrator');
|
||||
INSERT INTO principals (uri,email,displayname) VALUES ('principals/admin/calendar-proxy-read', null, null);
|
||||
INSERT INTO principals (uri,email,displayname) VALUES ('principals/admin/calendar-proxy-write', null, null);
|
||||
|
||||
CREATE TABLE propertystorage (
|
||||
id integer primary key asc,
|
||||
path text,
|
||||
name text,
|
||||
valuetype integer,
|
||||
value string
|
||||
);
|
||||
|
||||
|
||||
CREATE UNIQUE INDEX path_property ON propertystorage (path, name);
|
||||
CREATE TABLE users (
|
||||
id integer primary key asc,
|
||||
username TEXT,
|
||||
digesta1 TEXT,
|
||||
UNIQUE(username)
|
||||
);
|
||||
|
||||
INSERT INTO users (username,digesta1) VALUES
|
||||
('admin', '87fd274b7b6c01e48d7c2f965da8ddf7');
|
||||
|
|
13
Makefile
Normal file
13
Makefile
Normal file
|
@ -0,0 +1,13 @@
|
|||
.PHONY: build-assets
|
||||
|
||||
|
||||
build-assets: vendor/autoload.php
|
||||
cat vendor/sabre/dav/examples/sql/mysql.*.sql > Core/Resources/Db/MySQL/db.sql
|
||||
cat vendor/sabre/dav/examples/sql/sqlite.*.sql > Core/Resources/Db/SQLite/db.sql
|
||||
|
||||
vendor/autoload.php: composer.lock
|
||||
composer install
|
||||
|
||||
composer.lock: composer.json
|
||||
composer update
|
||||
|
Loading…
Reference in a new issue