Merge pull request #6264 from nextcloud/dav-migrations

Move DAV app to migrations
This commit is contained in:
Roeland Jago Douma 2017-09-19 08:03:12 +02:00 committed by GitHub
commit 66698b2d42
3 changed files with 481 additions and 802 deletions

View File

@ -1,801 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<database>
<!--
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;
-->
<table>
<name>*dbprefix*addressbooks</name>
<declaration>
<field>
<name>id</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
<autoincrement>1</autoincrement>
<unsigned>true</unsigned>
<length>11</length>
</field>
<field>
<name>principaluri</name>
<type>text</type>
<length>255</length>
</field>
<field>
<name>displayname</name>
<type>text</type>
<length>255</length>
</field>
<field>
<name>uri</name>
<type>text</type>
<length>255</length>
</field>
<field>
<name>description</name>
<type>text</type>
<length>255</length>
</field>
<field>
<name>synctoken</name>
<type>integer</type>
<default>1</default>
<notnull>true</notnull>
<unsigned>true</unsigned>
</field>
<index>
<name>addressbook_index</name>
<unique>true</unique>
<field>
<name>principaluri</name>
</field>
<field>
<name>uri</name>
</field>
</index>
</declaration>
</table>
<!--
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;
-->
<table>
<name>*dbprefix*cards</name>
<declaration>
<field>
<name>id</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
<autoincrement>1</autoincrement>
<unsigned>true</unsigned>
<length>11</length>
</field>
<field>
<name>addressbookid</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
</field>
<field>
<name>carddata</name>
<type>blob</type>
</field>
<field>
<name>uri</name>
<type>text</type>
<length>255</length>
</field>
<field>
<name>lastmodified</name>
<type>integer</type>
<unsigned>true</unsigned>
<length>11</length>
</field>
<field>
<name>etag</name>
<type>text</type>
<length>32</length>
</field>
<field>
<name>size</name>
<type>integer</type>
<notnull>true</notnull>
<unsigned>true</unsigned>
<length>11</length>
</field>
</declaration>
</table>
<!--
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;
-->
<table>
<name>*dbprefix*addressbookchanges</name>
<declaration>
<field>
<name>id</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
<autoincrement>1</autoincrement>
<unsigned>true</unsigned>
<length>11</length>
</field>
<field>
<name>uri</name>
<type>text</type>
<length>255</length>
</field>
<field>
<name>synctoken</name>
<type>integer</type>
<default>1</default>
<notnull>true</notnull>
<unsigned>true</unsigned>
</field>
<field>
<name>addressbookid</name>
<type>integer</type>
<notnull>true</notnull>
</field>
<field>
<name>operation</name>
<type>integer</type>
<notnull>true</notnull>
<length>1</length>
</field>
<index>
<name>addressbookid_synctoken</name>
<field>
<name>addressbookid</name>
</field>
<field>
<name>synctoken</name>
</field>
</index>
</declaration>
</table>
<!--
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;
-->
<table>
<name>*dbprefix*calendarobjects</name>
<declaration>
<field>
<name>id</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
<autoincrement>1</autoincrement>
<unsigned>true</unsigned>
<length>11</length>
</field>
<field>
<name>calendardata</name>
<type>blob</type>
</field>
<field>
<name>uri</name>
<type>text</type>
<length>255</length>
</field>
<field>
<name>calendarid</name>
<type>integer</type>
<unsigned>true</unsigned>
<notnull>true</notnull>
</field>
<field>
<name>lastmodified</name>
<type>integer</type>
<unsigned>true</unsigned>
</field>
<field>
<name>etag</name>
<type>text</type>
<length>32</length>
</field>
<field>
<name>size</name>
<type>integer</type>
<notnull>true</notnull>
<unsigned>true</unsigned>
<length>11</length>
</field>
<field>
<name>componenttype</name>
<type>text</type>
<length>8</length>
</field>
<field>
<name>firstoccurence</name>
<type>integer</type>
<unsigned>true</unsigned>
<length>11</length>
</field>
<field>
<name>lastoccurence</name>
<type>integer</type>
<unsigned>true</unsigned>
<length>11</length>
</field>
<field>
<name>uid</name>
<type>text</type>
<length>255</length>
</field>
<field>
<comments>0 - public, 1 - private, 2 - confidential</comments>
<name>classification</name>
<type>integer</type>
<default>0</default>
</field>
<index>
<name>calobjects_index</name>
<unique>true</unique>
<field>
<name>calendarid</name>
</field>
<field>
<name>uri</name>
</field>
</index>
</declaration>
</table>
<!--
CREATE TABLE calendars (
id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
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 CLOB,
components VARBINARY(20),
transparent TINYINT(1) NOT NULL DEFAULT '0',
UNIQUE(principaluri, uri)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-->
<table>
<name>*dbprefix*calendars</name>
<declaration>
<field>
<name>id</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
<autoincrement>1</autoincrement>
<unsigned>true</unsigned>
<length>11</length>
</field>
<field>
<name>principaluri</name>
<type>text</type>
<length>255</length>
</field>
<field>
<name>displayname</name>
<type>text</type>
<length>255</length>
</field>
<field>
<name>uri</name>
<type>text</type>
<length>255</length>
</field>
<field>
<name>synctoken</name>
<type>integer</type>
<default>1</default>
<notnull>true</notnull>
<unsigned>true</unsigned>
</field>
<field>
<name>description</name>
<type>text</type>
<length>255</length>
</field>
<field>
<name>calendarorder</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
<unsigned>true</unsigned>
</field>
<field>
<name>calendarcolor</name>
<type>text</type>
</field>
<field>
<name>timezone</name>
<type>clob</type>
</field>
<field>
<name>components</name>
<type>text</type>
<length>64</length>
</field>
<field>
<name>transparent</name>
<type>integer</type>
<length>1</length>
<notnull>true</notnull>
<default>0</default>
</field>
<index>
<name>calendars_index</name>
<unique>true</unique>
<field>
<name>principaluri</name>
</field>
<field>
<name>uri</name>
</field>
</index>
</declaration>
</table>
<!--
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;
-->
<table>
<name>*dbprefix*calendarchanges</name>
<declaration>
<field>
<name>id</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
<autoincrement>1</autoincrement>
<unsigned>true</unsigned>
<length>11</length>
</field>
<field>
<name>uri</name>
<type>text</type>
<length>255</length>
</field>
<field>
<name>synctoken</name>
<type>integer</type>
<default>1</default>
<notnull>true</notnull>
<unsigned>true</unsigned>
</field>
<field>
<name>calendarid</name>
<type>integer</type>
<notnull>true</notnull>
</field>
<field>
<name>operation</name>
<type>integer</type>
<notnull>true</notnull>
<length>1</length>
</field>
<index>
<name>calendarid_synctoken</name>
<field>
<name>calendarid</name>
</field>
<field>
<name>synctoken</name>
</field>
</index>
</declaration>
</table>
<!--
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;
-->
<table>
<name>*dbprefix*calendarsubscriptions</name>
<declaration>
<field>
<name>id</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
<autoincrement>1</autoincrement>
<unsigned>true</unsigned>
<length>11</length>
</field>
<field>
<name>uri</name>
<type>text</type>
</field>
<field>
<name>principaluri</name>
<type>text</type>
<length>255</length>
</field>
<field>
<name>source</name>
<type>text</type>
<length>255</length>
</field>
<field>
<name>displayname</name>
<type>text</type>
<length>100</length>
</field>
<field>
<name>refreshrate</name>
<type>text</type>
<length>10</length>
</field>
<field>
<name>calendarorder</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
<unsigned>true</unsigned>
</field>
<field>
<name>calendarcolor</name>
<type>text</type>
</field>
<field>
<name>striptodos</name>
<type>integer</type>
<length>1</length>
</field>
<field>
<name>stripalarms</name>
<type>integer</type>
<length>1</length>
</field>
<field>
<name>stripattachments</name>
<type>integer</type>
<length>1</length>
</field>
<field>
<name>lastmodified</name>
<type>integer</type>
<unsigned>true</unsigned>
</field>
<index>
<name>calsub_index</name>
<unique>true</unique>
<field>
<name>principaluri</name>
</field>
<field>
<name>uri</name>
</field>
</index>
</declaration>
</table>
<!--
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;
-->
<table>
<name>*dbprefix*schedulingobjects</name>
<declaration>
<field>
<name>id</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
<autoincrement>1</autoincrement>
<unsigned>true</unsigned>
<length>11</length>
</field>
<field>
<name>principaluri</name>
<type>text</type>
<length>255</length>
</field>
<field>
<name>calendardata</name>
<type>blob</type>
</field>
<field>
<name>uri</name>
<type>text</type>
<length>255</length>
</field>
<field>
<name>lastmodified</name>
<type>integer</type>
<unsigned>true</unsigned>
</field>
<field>
<name>etag</name>
<type>text</type>
<length>32</length>
</field>
<field>
<name>size</name>
<type>integer</type>
<notnull>true</notnull>
<unsigned>true</unsigned>
<length>11</length>
</field>
</declaration>
</table>
<table>
<name>*dbprefix*cards_properties</name>
<declaration>
<field>
<name>id</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
<autoincrement>1</autoincrement>
<unsigned>true</unsigned>
<length>11</length>
</field>
<field>
<name>addressbookid</name>
<type>integer</type>
<default></default>
<notnull>true</notnull>
<length>11</length>
</field>
<field>
<name>cardid</name>
<type>integer</type>
<default></default>
<notnull>true</notnull>
<unsigned>true</unsigned>
<length>11</length>
</field>
<field>
<name>name</name>
<type>text</type>
<default></default>
<notnull>false</notnull>
<length>64</length>
</field>
<field>
<name>value</name>
<type>text</type>
<default></default>
<notnull>false</notnull>
<length>255</length>
</field>
<field>
<name>preferred</name>
<type>integer</type>
<default>1</default>
<notnull>true</notnull>
<length>4</length>
</field>
<index>
<name>card_contactid_index</name>
<field>
<name>cardid</name>
<sorting>ascending</sorting>
</field>
</index>
<index>
<name>card_name_index</name>
<field>
<name>name</name>
<sorting>ascending</sorting>
</field>
</index>
<index>
<name>card_value_index</name>
<field>
<name>value</name>
<sorting>ascending</sorting>
</field>
</index>
</declaration>
</table>
<table>
<name>*dbprefix*calendarobjects_props</name>
<declaration>
<field>
<name>id</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
<autoincrement>1</autoincrement>
<unsigned>true</unsigned>
<length>11</length>
</field>
<field>
<name>calendarid</name>
<type>integer</type>
<default></default>
<notnull>true</notnull>
<length>11</length>
</field>
<field>
<name>objectid</name>
<type>integer</type>
<default></default>
<notnull>true</notnull>
<unsigned>true</unsigned>
<length>11</length>
</field>
<field>
<name>name</name>
<type>text</type>
<default></default>
<notnull>false</notnull>
<length>64</length>
</field>
<field>
<name>parameter</name>
<type>text</type>
<default></default>
<notnull>false</notnull>
<length>64</length>
</field>
<field>
<name>value</name>
<type>text</type>
<default></default>
<notnull>false</notnull>
<length>255</length>
</field>
<index>
<name>calendarobject_index</name>
<field>
<name>objectid</name>
<sorting>ascending</sorting>
</field>
</index>
<index>
<name>calendarobject_name_index</name>
<field>
<name>name</name>
<sorting>ascending</sorting>
</field>
</index>
<index>
<name>calendarobject_value_index</name>
<field>
<name>value</name>
<sorting>ascending</sorting>
</field>
</index>
</declaration>
</table>
<table>
<name>*dbprefix*dav_shares</name>
<declaration>
<field>
<name>id</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
<autoincrement>1</autoincrement>
<unsigned>true</unsigned>
<length>11</length>
</field>
<field>
<name>principaluri</name>
<type>text</type>
<length>255</length>
</field>
<field>
<name>type</name>
<type>text</type>
<length>255</length>
</field>
<field>
<name>access</name>
<type>integer</type>
<length>1</length>
</field>
<field>
<name>resourceid</name>
<type>integer</type>
<notnull>true</notnull>
<unsigned>true</unsigned>
</field>
<field>
<name>publicuri</name>
<type>text</type>
<length>255</length>
</field>
<index>
<name>dav_shares_index</name>
<unique>true</unique>
<field>
<name>principaluri</name>
</field>
<field>
<name>resourceid</name>
</field>
<field>
<name>type</name>
</field>
<field>
<name>publicuri</name>
</field>
</index>
</declaration>
</table>
</database>

View File

@ -5,7 +5,7 @@
<description>WebDAV endpoint</description> <description>WebDAV endpoint</description>
<licence>AGPL</licence> <licence>AGPL</licence>
<author>owncloud.org</author> <author>owncloud.org</author>
<version>1.4.0</version> <version>1.4.1</version>
<default_enable/> <default_enable/>
<types> <types>
<filesystem/> <filesystem/>

View File

@ -0,0 +1,480 @@
<?php
/**
* @copyright 2017, Roeland Jago Douma <roeland@famdouma.nl>
*
* @author Roeland Jago Douma <roeland@famdouma.nl>
*
* @license GNU AGPL version 3 or any later version
*
* 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/>.
*
*/
namespace OCA\DAV\Migration;
use Doctrine\DBAL\Schema\Schema;
use OCP\Migration\SimpleMigrationStep;
use OCP\Migration\IOutput;
class Version1004001Date20170825134824 extends SimpleMigrationStep {
/**
* @param IOutput $output
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
* @param array $options
* @return null|Schema
* @since 13.0.0
*/
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
/** @var Schema $schema */
$schema = $schemaClosure();
if (!$schema->hasTable('addressbooks')) {
$table = $schema->createTable('addressbooks');
$table->addColumn('id', 'bigint', [
'autoincrement' => true,
'notnull' => true,
'length' => 11,
'unsgined' => true,
]);
$table->addColumn('principaluri', 'string', [
'notnull' => false,
'length' => 255,
]);
$table->addColumn('displayname', 'string', [
'notnull' => false,
'length' => 255,
]);
$table->addColumn('uri', 'string', [
'notnull' => false,
'length' => 255,
]);
$table->addColumn('description', 'string', [
'notnull' => false,
'length' => 255,
]);
$table->addColumn('synctoken', 'integer', [
'notnull' => true,
'default' => 1,
'length' => 10,
'unsigned' => true,
]);
$table->setPrimaryKey(['id']);
$table->addUniqueIndex(['principaluri', 'uri'], 'addressbook_index');
}
if (!$schema->hasTable('cards')) {
$table = $schema->createTable('cards');
$table->addColumn('id', 'bigint', [
'autoincrement' => true,
'notnull' => true,
'length' => 11,
'unsigned' => true,
]);
$table->addColumn('addressbookid', 'integer', [
'notnull' => true,
'default' => 0,
]);
$table->addColumn('carddata', 'blob', [
'notnull' => false,
]);
$table->addColumn('uri', 'string', [
'notnull' => false,
'length' => 255,
]);
$table->addColumn('lastmodified', 'bigint', [
'notnull' => false,
'length' => 11,
'unsigned' => true,
]);
$table->addColumn('etag', 'string', [
'notnull' => false,
'length' => 32,
]);
$table->addColumn('size', 'bigint', [
'notnull' => true,
'length' => 11,
'unsigned' => true,
]);
$table->setPrimaryKey(['id']);
}
if (!$schema->hasTable('addressbookchanges')) {
$table = $schema->createTable('addressbookchanges');
$table->addColumn('id', 'bigint', [
'autoincrement' => true,
'notnull' => true,
'length' => 11,
'unsigned' => true,
]);
$table->addColumn('uri', 'string', [
'notnull' => false,
'length' => 255,
]);
$table->addColumn('synctoken', 'integer', [
'notnull' => true,
'default' => 1,
'length' => 10,
'unsigned' => true,
]);
$table->addColumn('addressbookid', 'integer', [
'notnull' => true,
]);
$table->addColumn('operation', 'smallint', [
'notnull' => true,
'length' => 1,
]);
$table->setPrimaryKey(['id']);
$table->addIndex(['addressbookid', 'synctoken'], 'addressbookid_synctoken');
}
if (!$schema->hasTable('calendarobjects')) {
$table = $schema->createTable('calendarobjects');
$table->addColumn('id', 'bigint', [
'autoincrement' => true,
'notnull' => true,
'length' => 11,
'unsgined' => true,
]);
$table->addColumn('calendardata', 'blob', [
'notnull' => false,
]);
$table->addColumn('uri', 'string', [
'notnull' => false,
'length' => 255,
]);
$table->addColumn('calendarid', 'integer', [
'notnull' => true,
'length' => 10,
'unsigned' => true,
]);
$table->addColumn('lastmodified', 'integer', [
'notnull' => false,
'length' => 10,
'unsigned' => true,
]);
$table->addColumn('etag', 'string', [
'notnull' => false,
'length' => 32,
]);
$table->addColumn('size', 'bigint', [
'notnull' => true,
'length' => 11,
'unsigned' => true,
]);
$table->addColumn('componenttype', 'string', [
'notnull' => false,
'length' => 8,
]);
$table->addColumn('firstoccurence', 'bigint', [
'notnull' => false,
'length' => 11,
'unsigned' => true,
]);
$table->addColumn('lastoccurence', 'bigint', [
'notnull' => false,
'length' => 11,
'unsigned' => true,
]);
$table->addColumn('uid', 'string', [
'notnull' => false,
'length' => 255,
]);
$table->addColumn('classification', 'integer', [
'notnull' => false,
'default' => 0,
]);
$table->setPrimaryKey(['id']);
$table->addUniqueIndex(['calendarid', 'uri'], 'calobjects_index');
}
if (!$schema->hasTable('calendars')) {
$table = $schema->createTable('calendars');
$table->addColumn('id', 'bigint', [
'autoincrement' => true,
'notnull' => true,
'length' => 11,
'unsigned' => true,
]);
$table->addColumn('principaluri', 'string', [
'notnull' => false,
'length' => 255,
]);
$table->addColumn('displayname', 'string', [
'notnull' => false,
'length' => 255,
]);
$table->addColumn('uri', 'string', [
'notnull' => false,
'length' => 255,
]);
$table->addColumn('synctoken', 'integer', [
'notnull' => true,
'default' => 1,
'unsigned' => true,
]);
$table->addColumn('description', 'string', [
'notnull' => false,
'length' => 255,
]);
$table->addColumn('calendarorder', 'integer', [
'notnull' => true,
'default' => 0,
'unsigned' => true,
]);
$table->addColumn('calendarcolor', 'string', [
'notnull' => false,
]);
$table->addColumn('timezone', 'text', [
'notnull' => false,
]);
$table->addColumn('components', 'string', [
'notnull' => false,
'length' => 64,
]);
$table->addColumn('transparent', 'smallint', [
'notnull' => true,
'length' => 1,
'default' => 0,
]);
$table->setPrimaryKey(['id']);
$table->addUniqueIndex(['principaluri', 'uri'], 'calendars_index');
}
if (!$schema->hasTable('calendarchanges')) {
$table = $schema->createTable('calendarchanges');
$table->addColumn('id', 'bigint', [
'autoincrement' => true,
'notnull' => true,
'length' => 11,
'unsgiend' => true,
]);
$table->addColumn('uri', 'string', [
'notnull' => false,
'length' => 255,
]);
$table->addColumn('synctoken', 'integer', [
'notnull' => true,
'default' => 1,
'length' => 10,
'unsigned' => true,
]);
$table->addColumn('calendarid', 'integer', [
'notnull' => true,
]);
$table->addColumn('operation', 'smallint', [
'notnull' => true,
'length' => 1,
]);
$table->setPrimaryKey(['id']);
$table->addIndex(['calendarid', 'synctoken'], 'calendarid_synctoken');
}
if (!$schema->hasTable('calendarsubscriptions')) {
$table = $schema->createTable('calendarsubscriptions');
$table->addColumn('id', 'bigint', [
'autoincrement' => true,
'notnull' => true,
'length' => 11,
'unsigned' => true,
]);
$table->addColumn('uri', 'string', [
'notnull' => false,
]);
$table->addColumn('principaluri', 'string', [
'notnull' => false,
'length' => 255,
]);
$table->addColumn('source', 'string', [
'notnull' => false,
'length' => 255,
]);
$table->addColumn('displayname', 'string', [
'notnull' => false,
'length' => 100,
]);
$table->addColumn('refreshrate', 'string', [
'notnull' => false,
'length' => 10,
]);
$table->addColumn('calendarorder', 'integer', [
'notnull' => true,
'default' => 0,
'unsigned' => true,
]);
$table->addColumn('calendarcolor', 'string', [
'notnull' => false,
]);
$table->addColumn('striptodos', 'smallint', [
'notnull' => false,
'length' => 1,
]);
$table->addColumn('stripalarms', 'smallint', [
'notnull' => false,
'length' => 1,
]);
$table->addColumn('stripattachments', 'smallint', [
'notnull' => false,
'length' => 1,
]);
$table->addColumn('lastmodified', 'integer', [
'notnull' => false,
'unsigned' => true,
]);
$table->setPrimaryKey(['id']);
$table->addUniqueIndex(['principaluri', 'uri'], 'calsub_index');
}
if (!$schema->hasTable('schedulingobjects')) {
$table = $schema->createTable('schedulingobjects');
$table->addColumn('id', 'bigint', [
'autoincrement' => true,
'notnull' => true,
'length' => 11,
'unsigned' => true,
]);
$table->addColumn('principaluri', 'string', [
'notnull' => false,
'length' => 255,
]);
$table->addColumn('calendardata', 'blob', [
'notnull' => false,
]);
$table->addColumn('uri', 'string', [
'notnull' => false,
'length' => 255,
]);
$table->addColumn('lastmodified', 'integer', [
'notnull' => false,
'unsigned' => true,
]);
$table->addColumn('etag', 'string', [
'notnull' => false,
'length' => 32,
]);
$table->addColumn('size', 'bigint', [
'notnull' => true,
'length' => 11,
'unsigned' => true,
]);
$table->setPrimaryKey(['id']);
}
if (!$schema->hasTable('cards_properties')) {
$table = $schema->createTable('cards_properties');
$table->addColumn('id', 'bigint', [
'autoincrement' => true,
'notnull' => true,
'length' => 11,
'unsigned' => true,
]);
$table->addColumn('addressbookid', 'bigint', [
'notnull' => true,
'length' => 11,
'default' => 0,
]);
$table->addColumn('cardid', 'bigint', [
'notnull' => true,
'length' => 11,
'default' => 0,
'unsigned' => true,
]);
$table->addColumn('name', 'string', [
'notnull' => false,
'length' => 64,
]);
$table->addColumn('value', 'string', [
'notnull' => false,
'length' => 255,
]);
$table->addColumn('preferred', 'integer', [
'notnull' => true,
'length' => 4,
'default' => 1,
]);
$table->setPrimaryKey(['id']);
$table->addIndex(['cardid'], 'card_contactid_index');
$table->addIndex(['name'], 'card_name_index');
$table->addIndex(['value'], 'card_value_index');
}
if (!$schema->hasTable('calendarobjects_props')) {
$table = $schema->createTable('calendarobjects_props');
$table->addColumn('id', 'bigint', [
'autoincrement' => true,
'notnull' => true,
'length' => 11,
'unsigned' => true,
]);
$table->addColumn('calendarid', 'bigint', [
'notnull' => true,
'length' => 11,
'default' => 0,
]);
$table->addColumn('objectid', 'bigint', [
'notnull' => true,
'length' => 11,
'default' => 0,
'unsigned' => true,
]);
$table->addColumn('name', 'string', [
'notnull' => false,
'length' => 64,
]);
$table->addColumn('parameter', 'string', [
'notnull' => false,
'length' => 64,
]);
$table->addColumn('value', 'string', [
'notnull' => false,
'length' => 255,
]);
$table->setPrimaryKey(['id']);
$table->addIndex(['objectid'], 'calendarobject_index');
$table->addIndex(['name'], 'calendarobject_name_index');
$table->addIndex(['value'], 'calendarobject_value_index');
}
if (!$schema->hasTable('dav_shares')) {
$table = $schema->createTable('dav_shares');
$table->addColumn('id', 'bigint', [
'autoincrement' => true,
'notnull' => true,
'length' => 11,
'unsigned' => true,
]);
$table->addColumn('principaluri', 'string', [
'notnull' => false,
'length' => 255,
]);
$table->addColumn('type', 'string', [
'notnull' => false,
'length' => 255,
]);
$table->addColumn('access', 'smallint', [
'notnull' => false,
'length' => 1,
]);
$table->addColumn('resourceid', 'integer', [
'notnull' => true,
'unsigned' => true,
]);
$table->addColumn('publicuri', 'string', [
'notnull' => false,
'length' => 255,
]);
$table->setPrimaryKey(['id']);
$table->addUniqueIndex(['principaluri', 'resourceid', 'type', 'publicuri'], 'dav_shares_index');
}
return $schema;
}
}