diff options
author | KERIOU Samir <samir.keriou@gendarmerie.interieur.gouv.fr> | 2020-06-26 09:54:10 +0300 |
---|---|---|
committer | KERIOU Samir <samir.keriou@gendarmerie.interieur.gouv.fr> | 2020-07-07 15:20:52 +0300 |
commit | da2b25ccab40a1250aecad2b1d6c4dd71133c32d (patch) | |
tree | ff6377d8b5b5081623201b4dee7b60d9b5747b37 /lib/Migration | |
parent | 91aa8c52613fcc1c6ebdfbf5cf80da8f0bb224d2 (diff) |
reindent code, new migration
Signed-off-by: KERIOU Samir <samir.keriou@gendarmerie.interieur.gouv.fr>
Diffstat (limited to 'lib/Migration')
-rw-r--r-- | lib/Migration/Version2060Date20200302132145.php | 92 | ||||
-rw-r--r-- | lib/Migration/Version2060Date202006240845.php | 81 |
2 files changed, 105 insertions, 68 deletions
diff --git a/lib/Migration/Version2060Date20200302132145.php b/lib/Migration/Version2060Date20200302132145.php index 71c34873..766dbb14 100644 --- a/lib/Migration/Version2060Date20200302132145.php +++ b/lib/Migration/Version2060Date20200302132145.php @@ -9,71 +9,27 @@ use OCP\DB\ISchemaWrapper; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; -class Version2060Date20200302132145 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; - } - -}
\ No newline at end of file +class Version2060Date20200302132145 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'); + $table->addColumn('share', 'string', [ + 'notnull' => false, + 'length' => 64 + ]); + + return $schema; + } + +} diff --git a/lib/Migration/Version2060Date202006240845.php b/lib/Migration/Version2060Date202006240845.php new file mode 100644 index 00000000..fa110b04 --- /dev/null +++ b/lib/Migration/Version2060Date202006240845.php @@ -0,0 +1,81 @@ +<?php + +declare(strict_types=1); + +namespace OCA\Richdocuments\Migration; + +use Closure; +use OCP\DB\ISchemaWrapper; +use OCP\Migration\IOutput; +use OCP\Migration\SimpleMigrationStep; + +class Version2060Date20200302132145 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; + } + +}
\ No newline at end of file |