From 347ab5241cb078f7d5a81aa921d55ffe76ebf02a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 30 Jun 2020 21:24:51 +0200 Subject: [PATCH] Move files_external to migrations Signed-off-by: Joas Schilling --- apps/files_external/appinfo/database.xml | 225 ------------------ apps/files_external/appinfo/info.xml | 2 +- .../Version1011Date20200630192246.php | 150 ++++++++++++ 3 files changed, 151 insertions(+), 226 deletions(-) delete mode 100644 apps/files_external/appinfo/database.xml create mode 100644 apps/files_external/lib/Migration/Version1011Date20200630192246.php diff --git a/apps/files_external/appinfo/database.xml b/apps/files_external/appinfo/database.xml deleted file mode 100644 index e39144931a..0000000000 --- a/apps/files_external/appinfo/database.xml +++ /dev/null @@ -1,225 +0,0 @@ - - *dbname* - true - false - utf8 - - *dbprefix*external_mounts - - - mount_id - integer - 0 - true - 1 - 6 - - - mount_point - text - 128 - true - - - storage_backend - text - 64 - true - - - auth_backend - text - 64 - true - - - priority - integer - 100 - 4 - true - - - - type - integer - 4 - true - - -
- - *dbprefix*external_applicable - - - applicable_id - integer - 0 - true - 1 - 6 - - - - mount_id - integer - true - 6 - - - - type - integer - 4 - true - - - - value - text - 64 - - - - applicable_mount - - mount_id - ascending - - - - applicable_type_value - - type - ascending - - - value - ascending - - - - applicable_type_value_mount - true - - type - ascending - - - value - ascending - - - mount_id - ascending - - - -
- - - *dbprefix*external_config - - - config_id - integer - 0 - true - 1 - 6 - - - - mount_id - integer - true - 6 - - - key - text - true - 64 - - - value - text - false - 4096 - - - - config_mount - - mount_id - ascending - - - - config_mount_key - true - - mount_id - ascending - - - key - ascending - - - -
- - - *dbprefix*external_options - - - option_id - integer - 0 - true - 1 - 6 - - - - mount_id - integer - true - 6 - - - key - text - true - 64 - - - value - text - true - 256 - - - - option_mount - - mount_id - ascending - - - - option_mount_key - true - - mount_id - ascending - - - key - ascending - - - -
-
diff --git a/apps/files_external/appinfo/info.xml b/apps/files_external/appinfo/info.xml index 59c7a04701..c2ac25bcea 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. - 1.11.0 + 1.11.1 agpl Robin Appelman Michael Gapczynski diff --git a/apps/files_external/lib/Migration/Version1011Date20200630192246.php b/apps/files_external/lib/Migration/Version1011Date20200630192246.php new file mode 100644 index 0000000000..4ffff07e00 --- /dev/null +++ b/apps/files_external/lib/Migration/Version1011Date20200630192246.php @@ -0,0 +1,150 @@ + + * + * @author Joas Schilling + * + * @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\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; + } +}