Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-06-30 22:24:51 +0300
committerJoas Schilling <coding@schilljs.com>2020-07-06 17:42:14 +0300
commit347ab5241cb078f7d5a81aa921d55ffe76ebf02a (patch)
treed0c1ca8417a68c40bde3faa8daa3065eff275794 /apps/files_external
parent41d1d6d20e3614e08b7498e342c626571802640c (diff)
Move files_external to migrations
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/files_external')
-rw-r--r--apps/files_external/appinfo/database.xml225
-rw-r--r--apps/files_external/appinfo/info.xml2
-rw-r--r--apps/files_external/lib/Migration/Version1011Date20200630192246.php150
3 files changed, 151 insertions, 226 deletions
diff --git a/apps/files_external/appinfo/database.xml b/apps/files_external/appinfo/database.xml
deleted file mode 100644
index e39144931a7..00000000000
--- a/apps/files_external/appinfo/database.xml
+++ /dev/null
@@ -1,225 +0,0 @@
-<database>
- <name>*dbname*</name>
- <create>true</create>
- <overwrite>false</overwrite>
- <charset>utf8</charset>
- <table>
- <name>*dbprefix*external_mounts</name>
- <declaration>
- <field>
- <name>mount_id</name>
- <type>integer</type>
- <default>0</default>
- <notnull>true</notnull>
- <autoincrement>1</autoincrement>
- <length>6</length>
- </field>
- <field>
- <name>mount_point</name>
- <type>text</type>
- <length>128</length>
- <notnull>true</notnull>
- </field>
- <field>
- <name>storage_backend</name>
- <type>text</type>
- <length>64</length>
- <notnull>true</notnull>
- </field>
- <field>
- <name>auth_backend</name>
- <type>text</type>
- <length>64</length>
- <notnull>true</notnull>
- </field>
- <field>
- <name>priority</name>
- <type>integer</type>
- <default>100</default>
- <length>4</length>
- <notnull>true</notnull>
- </field>
- <!-- admin = 1, personal = 2-->
- <field>
- <name>type</name>
- <type>integer</type>
- <length>4</length>
- <notnull>true</notnull>
- </field>
- </declaration>
- </table>
- <table>
- <name>*dbprefix*external_applicable</name>
- <declaration>
- <field>
- <name>applicable_id</name>
- <type>integer</type>
- <default>0</default>
- <notnull>true</notnull>
- <autoincrement>1</autoincrement>
- <length>6</length>
- </field>
- <field>
- <!--foreign key: external_mounts.mount_id-->
- <name>mount_id</name>
- <type>integer</type>
- <notnull>true</notnull>
- <length>6</length>
- </field>
- <field>
- <!-- possible mount types: global = 1, group = 2, user = 3 -->
- <name>type</name>
- <type>integer</type>
- <length>4</length>
- <notnull>true</notnull>
- </field>
- <field>
- <!-- user_id, group_id or null for global mounts -->
- <name>value</name>
- <type>text</type>
- <length>64</length>
- </field>
-
- <index>
- <name>applicable_mount</name>
- <field>
- <name>mount_id</name>
- <sorting>ascending</sorting>
- </field>
- </index>
- <index>
- <name>applicable_type_value</name>
- <field>
- <name>type</name>
- <sorting>ascending</sorting>
- </field>
- <field>
- <name>value</name>
- <sorting>ascending</sorting>
- </field>
- </index>
- <index>
- <name>applicable_type_value_mount</name>
- <unique>true</unique>
- <field>
- <name>type</name>
- <sorting>ascending</sorting>
- </field>
- <field>
- <name>value</name>
- <sorting>ascending</sorting>
- </field>
- <field>
- <name>mount_id</name>
- <sorting>ascending</sorting>
- </field>
- </index>
- </declaration>
- </table>
-
- <table>
- <name>*dbprefix*external_config</name>
- <declaration>
- <field>
- <name>config_id</name>
- <type>integer</type>
- <default>0</default>
- <notnull>true</notnull>
- <autoincrement>1</autoincrement>
- <length>6</length>
- </field>
- <field>
- <!--foreign key: external_mounts.mount_id-->
- <name>mount_id</name>
- <type>integer</type>
- <notnull>true</notnull>
- <length>6</length>
- </field>
- <field>
- <name>key</name>
- <type>text</type>
- <notnull>true</notnull>
- <length>64</length>
- </field>
- <field>
- <name>value</name>
- <type>text</type>
- <notnull>false</notnull>
- <length>4096</length>
- </field>
-
- <index>
- <name>config_mount</name>
- <field>
- <name>mount_id</name>
- <sorting>ascending</sorting>
- </field>
- </index>
- <index>
- <name>config_mount_key</name>
- <unique>true</unique>
- <field>
- <name>mount_id</name>
- <sorting>ascending</sorting>
- </field>
- <field>
- <name>key</name>
- <sorting>ascending</sorting>
- </field>
- </index>
- </declaration>
- </table>
-
- <table>
- <name>*dbprefix*external_options</name>
- <declaration>
- <field>
- <name>option_id</name>
- <type>integer</type>
- <default>0</default>
- <notnull>true</notnull>
- <autoincrement>1</autoincrement>
- <length>6</length>
- </field>
- <field>
- <!--foreign key: external_mounts.mount_id-->
- <name>mount_id</name>
- <type>integer</type>
- <notnull>true</notnull>
- <length>6</length>
- </field>
- <field>
- <name>key</name>
- <type>text</type>
- <notnull>true</notnull>
- <length>64</length>
- </field>
- <field>
- <name>value</name>
- <type>text</type>
- <notnull>true</notnull>
- <length>256</length>
- </field>
-
- <index>
- <name>option_mount</name>
- <field>
- <name>mount_id</name>
- <sorting>ascending</sorting>
- </field>
- </index>
- <index>
- <name>option_mount_key</name>
- <unique>true</unique>
- <field>
- <name>mount_id</name>
- <sorting>ascending</sorting>
- </field>
- <field>
- <name>key</name>
- <sorting>ascending</sorting>
- </field>
- </index>
- </declaration>
- </table>
-</database>
diff --git a/apps/files_external/appinfo/info.xml b/apps/files_external/appinfo/info.xml
index 59c7a047010..c2ac25bcea9 100644
--- a/apps/files_external/appinfo/info.xml
+++ b/apps/files_external/appinfo/info.xml
@@ -9,7 +9,7 @@ This application enables administrators to configure connections to external sto
External storage can be configured using the GUI or at the command line. This second option provides the advanced user with more flexibility for configuring bulk external storage mounts and setting mount priorities. More information is available in the external storage GUI documentation and the external storage Configuration File documentation.
</description>
- <version>1.11.0</version>
+ <version>1.11.1</version>
<licence>agpl</licence>
<author>Robin Appelman</author>
<author>Michael Gapczynski</author>
diff --git a/apps/files_external/lib/Migration/Version1011Date20200630192246.php b/apps/files_external/lib/Migration/Version1011Date20200630192246.php
new file mode 100644
index 00000000000..4ffff07e000
--- /dev/null
+++ b/apps/files_external/lib/Migration/Version1011Date20200630192246.php
@@ -0,0 +1,150 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2020 Joas Schilling <coding@schilljs.com>
+ *
+ * @author Joas Schilling <coding@schilljs.com>
+ *
+ * @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\Files_External\Migration;
+
+use Closure;
+use Doctrine\DBAL\Types\Types;
+use OCP\DB\ISchemaWrapper;
+use OCP\Migration\IOutput;
+use OCP\Migration\SimpleMigrationStep;
+
+class Version1011Date20200630192246 extends SimpleMigrationStep {
+ /**
+ * @param IOutput $output
+ * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
+ * @param array $options
+ * @return null|ISchemaWrapper
+ */
+ public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
+ /** @var ISchemaWrapper $schema */
+ $schema = $schemaClosure();
+
+ if (!$schema->hasTable('external_mounts')) {
+ $table = $schema->createTable('external_mounts');
+ $table->addColumn('mount_id', Types::BIGINT, [
+ 'autoincrement' => true,
+ 'notnull' => true,
+ 'length' => 6,
+ ]);
+ $table->addColumn('mount_point', Types::STRING, [
+ 'notnull' => true,
+ 'length' => 128,
+ ]);
+ $table->addColumn('storage_backend', Types::STRING, [
+ 'notnull' => true,
+ 'length' => 64,
+ ]);
+ $table->addColumn('auth_backend', Types::STRING, [
+ 'notnull' => true,
+ 'length' => 64,
+ ]);
+ $table->addColumn('priority', Types::INTEGER, [
+ 'notnull' => true,
+ 'length' => 4,
+ 'default' => 100,
+ ]);
+ $table->addColumn('type', Types::INTEGER, [
+ 'notnull' => true,
+ 'length' => 4,
+ ]);
+ $table->setPrimaryKey(['mount_id']);
+ }
+
+ if (!$schema->hasTable('external_applicable')) {
+ $table = $schema->createTable('external_applicable');
+ $table->addColumn('applicable_id', Types::BIGINT, [
+ 'autoincrement' => true,
+ 'notnull' => true,
+ 'length' => 6,
+ ]);
+ $table->addColumn('mount_id', Types::BIGINT, [
+ 'notnull' => true,
+ 'length' => 6,
+ ]);
+ $table->addColumn('type', Types::INTEGER, [
+ 'notnull' => true,
+ 'length' => 4,
+ ]);
+ $table->addColumn('value', Types::STRING, [
+ 'notnull' => false,
+ 'length' => 64,
+ ]);
+ $table->setPrimaryKey(['applicable_id']);
+ $table->addIndex(['mount_id'], 'applicable_mount');
+ $table->addIndex(['type', 'value'], 'applicable_type_value');
+ $table->addUniqueIndex(['type', 'value', 'mount_id'], 'applicable_type_value_mount');
+ }
+
+ if (!$schema->hasTable('external_config')) {
+ $table = $schema->createTable('external_config');
+ $table->addColumn('config_id', Types::BIGINT, [
+ 'autoincrement' => true,
+ 'notnull' => true,
+ 'length' => 6,
+ ]);
+ $table->addColumn('mount_id', Types::BIGINT, [
+ 'notnull' => true,
+ 'length' => 6,
+ ]);
+ $table->addColumn('key', Types::STRING, [
+ 'notnull' => true,
+ 'length' => 64,
+ ]);
+ $table->addColumn('value', Types::STRING, [
+ 'notnull' => false,
+ 'length' => 4096,
+ ]);
+ $table->setPrimaryKey(['config_id']);
+ $table->addIndex(['mount_id'], 'config_mount');
+ $table->addUniqueIndex(['mount_id', 'key'], 'config_mount_key');
+ }
+
+ if (!$schema->hasTable('external_options')) {
+ $table = $schema->createTable('external_options');
+ $table->addColumn('option_id', Types::BIGINT, [
+ 'autoincrement' => true,
+ 'notnull' => true,
+ 'length' => 6,
+ ]);
+ $table->addColumn('mount_id', Types::BIGINT, [
+ 'notnull' => true,
+ 'length' => 6,
+ ]);
+ $table->addColumn('key', Types::STRING, [
+ 'notnull' => true,
+ 'length' => 64,
+ ]);
+ $table->addColumn('value', Types::STRING, [
+ 'notnull' => true,
+ 'length' => 256,
+ ]);
+ $table->setPrimaryKey(['option_id']);
+ $table->addIndex(['mount_id'], 'option_mount');
+ $table->addUniqueIndex(['mount_id', 'key'], 'option_mount_key');
+ }
+ return $schema;
+ }
+}