diff options
author | Sergey Linnik <sergey.linnik@onlyoffice.com> | 2022-10-03 16:52:31 +0300 |
---|---|---|
committer | Sergey Linnik <sergey.linnik@onlyoffice.com> | 2022-10-03 16:52:31 +0300 |
commit | e2714c268dd5d153724c6ad33195db9bf2a1c8b0 (patch) | |
tree | afef6c4a19543e42266cb9177a87779b208a4c78 | |
parent | a5ede1d9a7f8a182e427eebd707cf9888bb8a7c9 (diff) | |
parent | ccab6da61a716dd4eecb84505b9ac47c464708b7 (diff) |
Merge branch 'feature/migration-fix' into develop
-rw-r--r-- | lib/Migration/Version070400Date20220929111111.php | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/lib/Migration/Version070400Date20220929111111.php b/lib/Migration/Version070400Date20220929111111.php new file mode 100644 index 0000000..0256498 --- /dev/null +++ b/lib/Migration/Version070400Date20220929111111.php @@ -0,0 +1,89 @@ +<?php + +declare(strict_types=1); + +namespace OCA\Onlyoffice\Migration; + +use Closure; +use OCP\DB\ISchemaWrapper; +use OCP\Migration\IOutput; +use OCP\Migration\SimpleMigrationStep; + +/** + * Auto-generated migration step: Please modify to your needs! + */ +class Version070400Date20220929111111 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): void { + } + + /** + * @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): ?ISchemaWrapper { + /** @var ISchemaWrapper $schema */ + $schema = $schemaClosure(); + + if (!$schema->hasTable('onlyoffice_filekey')) { + $table = $schema->createTable('onlyoffice_filekey'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + ]); + $table->addColumn('file_id', 'bigint', [ + 'notnull' => false, + 'default' => '-1', + ]); + $table->addColumn('key', 'string', [ + 'notnull' => true, + 'length' => 128, + ]); + $table->addColumn('lock', 'integer', [ + 'notnull' => true, + 'default' => 0, + ]); + $table->addColumn('fs', 'integer', [ + 'notnull' => true, + 'default' => 0, + ]); + $table->setPrimaryKey(['id']); + $table->addUniqueIndex(['file_id'], 'onlyoffice_file_id_index'); + } + + if (!$schema->hasTable('onlyoffice_permissions')) { + $table = $schema->createTable('onlyoffice_permissions'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + ]); + $table->addColumn('share_id', 'bigint', [ + 'notnull' => true, + 'default' => '-1', + ]); + $table->addColumn('permissions', 'integer', [ + 'notnull' => true, + 'default' => 0, + ]); + $table->setPrimaryKey(['id']); + $table->addUniqueIndex(['share_id'], 'onlyoffice_share_id_index'); + } + + 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): void { + } +} |