diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2022-05-05 19:21:12 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-05 19:21:12 +0300 |
commit | bb075eb1a509f6358435c590f8c98be66b9ddd8e (patch) | |
tree | f983e113d72c7023f9469ab7e27b802e5a9d0560 | |
parent | ee0738799e0cc8af4606e952ca76708cae7b34fc (diff) | |
parent | d1d19fb738481b795873f2fbf40ea2fb45359604 (diff) |
Merge pull request #687 from nextcloud/fix/noid/ticks-data-is-text
switching _ticks.data to text
-rw-r--r-- | lib/Migration/Version2000Date20201208130255.php | 8 | ||||
-rw-r--r-- | lib/Migration/Version23001Date20220408140253.php | 6 | ||||
-rw-r--r-- | lib/Migration/Version23001Date20220505144434.php | 41 |
3 files changed, 52 insertions, 3 deletions
diff --git a/lib/Migration/Version2000Date20201208130255.php b/lib/Migration/Version2000Date20201208130255.php index dc6d710..22fe658 100644 --- a/lib/Migration/Version2000Date20201208130255.php +++ b/lib/Migration/Version2000Date20201208130255.php @@ -6,6 +6,7 @@ namespace OCA\FullTextSearch\Migration; use Closure; use OCP\DB\ISchemaWrapper; +use OCP\DB\Types; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; @@ -26,6 +27,7 @@ class Version2000Date20201208130255 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) { @@ -44,9 +46,8 @@ class Version2000Date20201208130255 extends SimpleMigrationStep { 'notnull' => false, 'length' => 128, ]); - $table->addColumn('data', 'string', [ - 'notnull' => false, - 'length' => 6000, + $table->addColumn('data', Types::TEXT, [ + 'notnull' => false ]); $table->addColumn('status', 'string', [ 'notnull' => false, @@ -66,6 +67,7 @@ class Version2000Date20201208130255 extends SimpleMigrationStep { ]); $table->setPrimaryKey(['id']); } + return $schema; } diff --git a/lib/Migration/Version23001Date20220408140253.php b/lib/Migration/Version23001Date20220408140253.php index ec7d6fe..6d1cc17 100644 --- a/lib/Migration/Version23001Date20220408140253.php +++ b/lib/Migration/Version23001Date20220408140253.php @@ -38,12 +38,17 @@ class Version23001Date20220408140253 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): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); + if (!$schema->hasTable('fulltextsearch_indexes')) { + return null; + } + $table = $schema->getTable('fulltextsearch_indexes'); $column = $table->getColumn('message'); @@ -52,6 +57,7 @@ class Version23001Date20220408140253 extends SimpleMigrationStep { } $column->setType(Type::getType(Types::TEXT)); + return $schema; } } diff --git a/lib/Migration/Version23001Date20220505144434.php b/lib/Migration/Version23001Date20220505144434.php new file mode 100644 index 0000000..9bad9b8 --- /dev/null +++ b/lib/Migration/Version23001Date20220505144434.php @@ -0,0 +1,41 @@ +<?php + +declare(strict_types=1); + +namespace OCA\FullTextSearch\Migration; + +use Closure; +use Doctrine\DBAL\Types\Type; +use OCP\DB\ISchemaWrapper; +use OCP\DB\Types; +use OCP\Migration\IOutput; +use OCP\Migration\SimpleMigrationStep; + +class Version23001Date20220505144434 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): ?ISchemaWrapper { + /** @var ISchemaWrapper $schema */ + $schema = $schemaClosure(); + + if (!$schema->hasTable('fulltextsearch_ticks')) { + return null; + } + + $table = $schema->getTable('fulltextsearch_ticks'); + $column = $table->getColumn('data'); + + if ($column->getType()->getName() === Types::TEXT) { + return null; + } + + $column->setType(Type::getType(Types::TEXT)); + + return $schema; + } +} |