From 32234a23da7440f85617a3347b87c7b08ed7536a Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Fri, 25 Aug 2017 15:52:14 +0200 Subject: [PATCH] Move DAV app to migrations Signed-off-by: Roeland Jago Douma --- apps/dav/appinfo/database.xml | 801 ------------------ apps/dav/appinfo/info.xml | 2 +- .../Version1004001Date20170825134824.php | 480 +++++++++++ 3 files changed, 481 insertions(+), 802 deletions(-) delete mode 100644 apps/dav/appinfo/database.xml create mode 100644 apps/dav/lib/Migration/Version1004001Date20170825134824.php diff --git a/apps/dav/appinfo/database.xml b/apps/dav/appinfo/database.xml deleted file mode 100644 index b3a69de070..0000000000 --- a/apps/dav/appinfo/database.xml +++ /dev/null @@ -1,801 +0,0 @@ - - - - - - - *dbprefix*addressbooks - - - - - id - integer - 0 - true - 1 - true - 11 - - - - principaluri - text - 255 - - - displayname - text - 255 - - - uri - text - 255 - - - description - text - 255 - - - synctoken - integer - 1 - true - true - - - addressbook_index - true - - principaluri - - - uri - - - -
- - - - *dbprefix*cards - - - id - integer - 0 - true - 1 - true - 11 - - - addressbookid - integer - 0 - true - - - carddata - blob - - - uri - text - 255 - - - lastmodified - integer - true - 11 - - - etag - text - 32 - - - size - integer - true - true - 11 - - -
- - - - - *dbprefix*addressbookchanges - - - id - integer - 0 - true - 1 - true - 11 - - - uri - text - 255 - - - synctoken - integer - 1 - true - true - - - addressbookid - integer - true - - - operation - integer - true - 1 - - - - addressbookid_synctoken - - addressbookid - - - synctoken - - - - -
- - - - - *dbprefix*calendarobjects - - - id - integer - 0 - true - 1 - true - 11 - - - calendardata - blob - - - uri - text - 255 - - - calendarid - integer - true - true - - - lastmodified - integer - true - - - etag - text - 32 - - - size - integer - true - true - 11 - - - componenttype - text - 8 - - - firstoccurence - integer - true - 11 - - - lastoccurence - integer - true - 11 - - - uid - text - 255 - - - 0 - public, 1 - private, 2 - confidential - classification - integer - 0 - - - calobjects_index - true - - calendarid - - - uri - - - -
- - - *dbprefix*calendars - - - id - integer - 0 - true - 1 - true - 11 - - - principaluri - text - 255 - - - displayname - text - 255 - - - uri - text - 255 - - - synctoken - integer - 1 - true - true - - - description - text - 255 - - - calendarorder - integer - 0 - true - true - - - calendarcolor - text - - - timezone - clob - - - components - text - 64 - - - transparent - integer - 1 - true - 0 - - - calendars_index - true - - principaluri - - - uri - - - -
- - - *dbprefix*calendarchanges - - - id - integer - 0 - true - 1 - true - 11 - - - uri - text - 255 - - - synctoken - integer - 1 - true - true - - - calendarid - integer - true - - - operation - integer - true - 1 - - - - calendarid_synctoken - - calendarid - - - synctoken - - - - -
- - - - *dbprefix*calendarsubscriptions - - - id - integer - 0 - true - 1 - true - 11 - - - uri - text - - - principaluri - text - 255 - - - source - text - 255 - - - displayname - text - 100 - - - refreshrate - text - 10 - - - calendarorder - integer - 0 - true - true - - - calendarcolor - text - - - striptodos - integer - 1 - - - stripalarms - integer - 1 - - - stripattachments - integer - 1 - - - lastmodified - integer - true - - - calsub_index - true - - principaluri - - - uri - - - -
- - - - *dbprefix*schedulingobjects - - - id - integer - 0 - true - 1 - true - 11 - - - principaluri - text - 255 - - - calendardata - blob - - - uri - text - 255 - - - lastmodified - integer - true - - - etag - text - 32 - - - size - integer - true - true - 11 - - - -
- - - *dbprefix*cards_properties - - - id - integer - 0 - true - 1 - true - 11 - - - addressbookid - integer - - true - 11 - - - cardid - integer - - true - true - 11 - - - name - text - - false - 64 - - - value - text - - false - 255 - - - preferred - integer - 1 - true - 4 - - - card_contactid_index - - cardid - ascending - - - - card_name_index - - name - ascending - - - - card_value_index - - value - ascending - - - -
- - - *dbprefix*calendarobjects_props - - - id - integer - 0 - true - 1 - true - 11 - - - calendarid - integer - - true - 11 - - - objectid - integer - - true - true - 11 - - - name - text - - false - 64 - - - parameter - text - - false - 64 - - - value - text - - false - 255 - - - calendarobject_index - - objectid - ascending - - - - calendarobject_name_index - - name - ascending - - - - calendarobject_value_index - - value - ascending - - - -
- - - *dbprefix*dav_shares - - - id - integer - 0 - true - 1 - true - 11 - - - principaluri - text - 255 - - - type - text - 255 - - - access - integer - 1 - - - resourceid - integer - true - true - - - publicuri - text - 255 - - - dav_shares_index - true - - principaluri - - - resourceid - - - type - - - publicuri - - - -
-
diff --git a/apps/dav/appinfo/info.xml b/apps/dav/appinfo/info.xml index 8be603ee93..3d3bff52ea 100644 --- a/apps/dav/appinfo/info.xml +++ b/apps/dav/appinfo/info.xml @@ -5,7 +5,7 @@ WebDAV endpoint AGPL owncloud.org - 1.4.0 + 1.4.1 diff --git a/apps/dav/lib/Migration/Version1004001Date20170825134824.php b/apps/dav/lib/Migration/Version1004001Date20170825134824.php new file mode 100644 index 0000000000..a2a85d1e5b --- /dev/null +++ b/apps/dav/lib/Migration/Version1004001Date20170825134824.php @@ -0,0 +1,480 @@ + + * + * @author Roeland Jago Douma + * + * @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 . + * + */ +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; + } +}