diff options
author | Sergey Linnik <sergey.linnik@onlyoffice.com> | 2022-10-03 17:14:36 +0300 |
---|---|---|
committer | Sergey Linnik <sergey.linnik@onlyoffice.com> | 2022-10-03 17:14:36 +0300 |
commit | 878b623af63c18951a567c1a2eca5ee6033cf599 (patch) | |
tree | 34ee134750d446d569d9ff70e43dd71c10498c30 | |
parent | 35cf1af69972e8bbd0b2a3de9959abb9b93fe04c (diff) |
move creation table to new migration file
-rw-r--r-- | lib/Migration/Version070000Date20211219111111.php | 93 | ||||
-rw-r--r-- | lib/Migration/Version070400Date20220929111111.php | 22 |
2 files changed, 22 insertions, 93 deletions
diff --git a/lib/Migration/Version070000Date20211219111111.php b/lib/Migration/Version070000Date20211219111111.php deleted file mode 100644 index 38fc8f4..0000000 --- a/lib/Migration/Version070000Date20211219111111.php +++ /dev/null @@ -1,93 +0,0 @@ -<?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 Version070000Date20211219111111 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'], 'file_id_index'); - } - - if (!$schema->hasTable('onlyoffice_instance')) { - $table = $schema->createTable('onlyoffice_instance'); - $table->addColumn('id', 'integer', [ - 'autoincrement' => true, - 'notnull' => true, - ]); - $table->addColumn('remote', 'string', [ - 'notnull' => true, - 'length' => 128, - ]); - $table->addColumn('expire', 'bigint', [ - 'notnull' => true, - 'default' => 0, - ]); - $table->addColumn('status', 'integer', [ - 'notnull' => true, - 'default' => 0, - ]); - $table->setPrimaryKey(['id']); - $table->addUniqueIndex(['remote'], 'remote_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 { - } -}
\ No newline at end of file diff --git a/lib/Migration/Version070400Date20220929111111.php b/lib/Migration/Version070400Date20220929111111.php index 0256498..d42b3db 100644 --- a/lib/Migration/Version070400Date20220929111111.php +++ b/lib/Migration/Version070400Date20220929111111.php @@ -76,6 +76,28 @@ class Version070400Date20220929111111 extends SimpleMigrationStep { $table->addUniqueIndex(['share_id'], 'onlyoffice_share_id_index'); } + if (!$schema->hasTable('onlyoffice_instance')) { + $table = $schema->createTable('onlyoffice_instance'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + ]); + $table->addColumn('remote', 'string', [ + 'notnull' => true, + 'length' => 128, + ]); + $table->addColumn('expire', 'bigint', [ + 'notnull' => true, + 'default' => 0, + ]); + $table->addColumn('status', 'integer', [ + 'notnull' => true, + 'default' => 0, + ]); + $table->setPrimaryKey(['id']); + $table->addUniqueIndex(['remote'], 'onlyoffice_remote_index'); + } + return $schema; } |