diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2022-05-05 19:58:41 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-05 19:58:41 +0300 |
commit | ab3423bc426d4ab5b0db2026175e001e6a8810e4 (patch) | |
tree | e5d1c94e84b3c291546f5b0c9b123dd424a6117b | |
parent | 4fb0031808f0dffe4633f810b4007c46ac046008 (diff) | |
parent | 4e696f9055d7b1300668f03673ba64b96faaaabc (diff) |
Merge pull request #688 from nextcloud/backport/687/stable2424.0.0
[stable24] 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; + } +} |