diff --git a/appinfo/Migrations/Version20161209151129.php b/appinfo/Migrations/Version20161209151129.php new file mode 100644 index 00000000..989951c1 --- /dev/null +++ b/appinfo/Migrations/Version20161209151129.php @@ -0,0 +1,68 @@ +createGroupsTable($schema); + $this->createMembersTable($schema); + } + + private function createGroupsTable(Schema $schema) { + $prefix = $this->connection->getPrefix(); + $table = $schema->createTable("${prefix}custom_group"); + $table->addColumn('group_id', 'integer', [ + 'autoincrement' => true, + 'unsigned' => true, + 'length' => 4, + ]); + $table->addColumn('uri', 'string', [ + 'length' => 255, + 'notnull' => true, + ]); + $table->addColumn('display_name', 'string', [ + 'length' => 64, + 'notnull' => true, + ]); + // TODO: find how to set sort to ascending + $table->addUniqueIndex(['uri'], 'cg_uri_index'); + $table->setPrimaryKey(['group_id']); + } + + private function createMembersTable(Schema $schema) { + $prefix = $this->connection->getPrefix(); + $table = $schema->createTable("${prefix}custom_group_member"); + $table->addColumn('group_id', 'integer', [ + 'autoincrement' => true, + 'unsigned' => true, + 'length' => 4, + ]); + $table->addColumn('user_id', 'string', [ + 'length' => 64, + 'notnull' => true, + ]); + $table->addColumn('is_admin', 'integer', [ + 'length' => 4, + 'notnull' => true, + 'default' => 0, + ]); + $table->setPrimaryKey(['group_id', 'user_id']); + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) { + $schema->dropTable('custom_group_member'); + $schema->dropTable('custom_group'); + } +} diff --git a/appinfo/app.php b/appinfo/app.php new file mode 100644 index 00000000..58d1db86 --- /dev/null +++ b/appinfo/app.php @@ -0,0 +1,21 @@ + + * + * @copyright Copyright (c) 2016, ownCloud GmbH. + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * 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, version 3, + * along with this program. If not, see + * + */ + diff --git a/appinfo/info.xml b/appinfo/info.xml index 42b44810..99941f68 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -12,6 +12,7 @@ + true