diff options
Diffstat (limited to 'lib/Migration/Version23001Date20220505144434.php')
-rw-r--r-- | lib/Migration/Version23001Date20220505144434.php | 41 |
1 files changed, 41 insertions, 0 deletions
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; + } +} |