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 @@
|
||||||
--
|
CREATE TABLE addressbooks (
|
||||||
-- This is the empty database schema for Baïkal
|
id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||||
-- Corresponds to the MySQL Schema definition of project SabreDAV 1.8.6
|
principaluri VARBINARY(255),
|
||||||
-- http://code.google.com/p/sabredav/
|
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,
|
id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||||
username VARCHAR(50),
|
principaluri VARBINARY(100),
|
||||||
digesta1 VARCHAR(32),
|
displayname VARCHAR(100),
|
||||||
UNIQUE(username)
|
uri VARBINARY(200),
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
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 (
|
CREATE TABLE calendarchanges (
|
||||||
id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||||
uri VARCHAR(200) NOT NULL,
|
uri VARBINARY(200) NOT NULL,
|
||||||
email VARCHAR(80),
|
synctoken INT(11) UNSIGNED NOT NULL,
|
||||||
displayname VARCHAR(80),
|
calendarid INT(11) UNSIGNED NOT NULL,
|
||||||
vcardurl VARCHAR(255),
|
operation TINYINT(1) NOT NULL,
|
||||||
UNIQUE(uri)
|
INDEX calendarid_synctoken (calendarid, synctoken)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS groupmembers (
|
CREATE TABLE calendarsubscriptions (
|
||||||
id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||||
principal_id INTEGER UNSIGNED NOT NULL,
|
uri VARBINARY(200) NOT NULL,
|
||||||
member_id INTEGER UNSIGNED NOT NULL,
|
principaluri VARBINARY(100) NOT NULL,
|
||||||
UNIQUE(principal_id, member_id)
|
source TEXT,
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
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,
|
id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||||
owner VARCHAR(100),
|
owner VARCHAR(100),
|
||||||
timeout INTEGER UNSIGNED,
|
timeout INTEGER UNSIGNED,
|
||||||
created INTEGER,
|
created INTEGER,
|
||||||
token VARCHAR(100),
|
token VARBINARY(100),
|
||||||
scope TINYINT,
|
scope TINYINT,
|
||||||
depth TINYINT,
|
depth TINYINT,
|
||||||
uri VARCHAR(1000),
|
uri VARBINARY(1000),
|
||||||
INDEX(token),
|
INDEX(token),
|
||||||
INDEX(uri(100))
|
INDEX(uri(100))
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
CREATE TABLE principals (
|
||||||
CREATE TABLE IF NOT EXISTS calendarobjects (
|
|
||||||
id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||||
calendardata MEDIUMBLOB,
|
uri VARBINARY(200) NOT NULL,
|
||||||
uri VARCHAR(200),
|
email VARBINARY(80),
|
||||||
calendarid INTEGER UNSIGNED NOT NULL,
|
displayname VARCHAR(80),
|
||||||
lastmodified INT(11) UNSIGNED,
|
UNIQUE(uri)
|
||||||
etag VARCHAR(32),
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
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;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS calendars (
|
CREATE TABLE groupmembers (
|
||||||
id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||||
principaluri VARCHAR(100),
|
principal_id INTEGER UNSIGNED NOT NULL,
|
||||||
displayname VARCHAR(100),
|
member_id INTEGER UNSIGNED NOT NULL,
|
||||||
uri VARCHAR(200),
|
UNIQUE(principal_id, member_id)
|
||||||
ctag INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
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;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS addressbooks (
|
INSERT INTO principals (uri,email,displayname) VALUES
|
||||||
id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
('principals/admin', 'admin@example.org','Administrator'),
|
||||||
principaluri VARCHAR(255),
|
('principals/admin/calendar-proxy-read', null, null),
|
||||||
displayname VARCHAR(255),
|
('principals/admin/calendar-proxy-write', null, null);
|
||||||
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;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS cards (
|
CREATE TABLE propertystorage (
|
||||||
id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||||
addressbookid INT(11) UNSIGNED NOT NULL,
|
path VARBINARY(1024) NOT NULL,
|
||||||
carddata MEDIUMBLOB,
|
name VARBINARY(100) NOT NULL,
|
||||||
uri VARCHAR(200),
|
valuetype INT UNSIGNED,
|
||||||
lastmodified INT(11) UNSIGNED
|
value MEDIUMBLOB
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
) 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 (
|
CREATE TABLE addressbooks (
|
||||||
id integer primary key asc,
|
id integer primary key asc,
|
||||||
principaluri text,
|
principaluri text,
|
||||||
displayname text,
|
displayname text,
|
||||||
uri text,
|
uri text,
|
||||||
description text,
|
description text,
|
||||||
ctag integer
|
synctoken integer
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE cards (
|
CREATE TABLE cards (
|
||||||
|
@ -18,9 +12,20 @@ CREATE TABLE cards (
|
||||||
addressbookid integer,
|
addressbookid integer,
|
||||||
carddata blob,
|
carddata blob,
|
||||||
uri text,
|
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 (
|
CREATE TABLE calendarobjects (
|
||||||
id integer primary key asc,
|
id integer primary key asc,
|
||||||
calendardata blob,
|
calendardata blob,
|
||||||
|
@ -31,7 +36,8 @@ CREATE TABLE calendarobjects (
|
||||||
size integer,
|
size integer,
|
||||||
componenttype text,
|
componenttype text,
|
||||||
firstoccurence integer,
|
firstoccurence integer,
|
||||||
lastoccurence integer
|
lastoccurence integer,
|
||||||
|
uid text
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE calendars (
|
CREATE TABLE calendars (
|
||||||
|
@ -39,7 +45,7 @@ CREATE TABLE calendars (
|
||||||
principaluri text,
|
principaluri text,
|
||||||
displayname text,
|
displayname text,
|
||||||
uri text,
|
uri text,
|
||||||
ctag integer,
|
synctoken integer,
|
||||||
description text,
|
description text,
|
||||||
calendarorder integer,
|
calendarorder integer,
|
||||||
calendarcolor text,
|
calendarcolor text,
|
||||||
|
@ -48,23 +54,59 @@ CREATE TABLE calendars (
|
||||||
transparent bool
|
transparent bool
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE locks (
|
CREATE TABLE calendarchanges (
|
||||||
id integer primary key asc,
|
id integer primary key asc,
|
||||||
owner text,
|
uri text,
|
||||||
timeout integer,
|
synctoken integer,
|
||||||
created integer,
|
calendarid integer,
|
||||||
token text,
|
operation integer
|
||||||
scope integer,
|
|
||||||
depth integer,
|
|
||||||
uri text
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
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,
|
||||||
|
timeout integer,
|
||||||
|
created integer,
|
||||||
|
token text,
|
||||||
|
scope integer,
|
||||||
|
depth integer,
|
||||||
|
uri text
|
||||||
|
);
|
||||||
|
COMMIT;
|
||||||
CREATE TABLE principals (
|
CREATE TABLE principals (
|
||||||
id INTEGER PRIMARY KEY ASC,
|
id INTEGER PRIMARY KEY ASC,
|
||||||
uri TEXT,
|
uri TEXT,
|
||||||
email TEXT,
|
email TEXT,
|
||||||
displayname TEXT,
|
displayname TEXT,
|
||||||
vcardurl TEXT,
|
|
||||||
UNIQUE(uri)
|
UNIQUE(uri)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -75,9 +117,27 @@ CREATE TABLE groupmembers (
|
||||||
UNIQUE(principal_id, member_id)
|
UNIQUE(principal_id, member_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE users (
|
|
||||||
|
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,
|
id integer primary key asc,
|
||||||
username TEXT,
|
path text,
|
||||||
digesta1 TEXT,
|
name text,
|
||||||
UNIQUE(username)
|
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