diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Migration/Version2060Date20200302132145.php | 6 | ||||
-rw-r--r-- | lib/Migration/Version30704Date20200626072306.php | 78 |
2 files changed, 82 insertions, 2 deletions
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(); diff --git a/lib/Migration/Version30704Date20200626072306.php b/lib/Migration/Version30704Date20200626072306.php new file mode 100644 index 00000000..5094f3f4 --- /dev/null +++ b/lib/Migration/Version30704Date20200626072306.php @@ -0,0 +1,78 @@ +<?php + +declare(strict_types=1); + +namespace OCA\Richdocuments\Migration; + +use Closure; +use OCP\DB\ISchemaWrapper; +use OCP\Migration\SimpleMigrationStep; +use OCP\Migration\IOutput; + +class Version30704Date20200626072306 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(); + + $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; + } +} |