diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-09-03 18:12:53 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-03 18:12:53 +0300 |
commit | 86f141932b85d5925e0c7e075f69195bd1251e24 (patch) | |
tree | 3ed7fe67da52b25577f0bfa2dcc0392391393fc3 /lib | |
parent | f2f236f28faa53bc30a92be58a4fd7c7ef462d7a (diff) | |
parent | 6deaab17a3c9a553a4a49ca2f7b6d290878ae1f0 (diff) |
Merge pull request #1055 from SamKer/master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Migration/Version030702Date20200626072306.php | 97 | ||||
-rw-r--r-- | lib/Migration/Version2060Date20200302132145.php | 6 |
2 files changed, 101 insertions, 2 deletions
diff --git a/lib/Migration/Version030702Date20200626072306.php b/lib/Migration/Version030702Date20200626072306.php new file mode 100644 index 00000000..6832c73c --- /dev/null +++ b/lib/Migration/Version030702Date20200626072306.php @@ -0,0 +1,97 @@ +<?php + +declare(strict_types=1); + +namespace OCA\Richdocuments\Migration; + +use Closure; +use OCP\DB\ISchemaWrapper; +use OCP\Migration\SimpleMigrationStep; +use OCP\Migration\IOutput; + +/** + * Auto-generated migration step: Please modify to your needs! + */ +class Version030702Date20200626072306 extends SimpleMigrationStep { + + /** + * @param IOutput $output + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + * @param array $options + */ + public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { + } + + /** + * @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(); + + $table = $schema->getTable('richdocuments_wopi'); + + if (!$table->hasColumn('template_id')) { + $table->addColumn('template_id', 'integer', [ + 'notnull' => false, + 'length' => 4, + ]); + } + + if (!$table->hasColumn('hide_download')) { + $table->addColumn('hide_download', 'boolean', [ + 'notnull' => true, + 'default' => false, + ]); + } + + if (!$table->hasColumn('share')) { + $table->addColumn('share', 'string', [ + 'notnull' => false, + 'length' => 64 + ]); + } + + if (!$table->hasColumn('direct')) { + $table->addColumn('direct', 'boolean', [ + 'notnull' => true, + 'default' => false, + ]); + } + if (!$table->hasColumn('is_remote_token')) { + $table->addColumn('is_remote_token', 'boolean', [ + 'notnull' => true, + 'default' => false, + ]); + } + + if (!$table->hasColumn('remote_server')) { + $table->addColumn('remote_server', 'string', [ + 'notnull' => true, + 'default' => '', + ]); + + } + if (!$table->hasColumn('remote_server_token')) { + $table->addColumn('remote_server_token', 'string', [ + 'notnull' => true, + 'length' => 32, + 'default' => '', + ]); + } + + + return $schema; + } + + /** + * @param IOutput $output + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + * @param array $options + */ + public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { + } +} diff --git a/lib/Migration/Version2060Date20200302132145.php b/lib/Migration/Version2060Date20200302132145.php index 9869e5ad..766dbb14 100644 --- a/lib/Migration/Version2060Date20200302132145.php +++ b/lib/Migration/Version2060Date20200302132145.php @@ -9,7 +9,8 @@ use OCP\DB\ISchemaWrapper; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; -class Version2060Date20200302132145 extends SimpleMigrationStep { +class Version2060Date20200302132145 extends SimpleMigrationStep +{ /** * @param IOutput $output @@ -17,7 +18,8 @@ class Version2060Date20200302132145 extends SimpleMigrationStep { * @param array $options * @return null|ISchemaWrapper */ - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) + { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); |