43 lines
1.0 KiB
PHP
43 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
/**
|
|
* SPDX-FileCopyrightText: 2025 F7cloud GmbH and F7cloud contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
namespace OCA\Assistant\Migration;
|
|
|
|
use Closure;
|
|
use OCP\DB\ISchemaWrapper;
|
|
use OCP\DB\Types;
|
|
use OCP\Migration\IOutput;
|
|
use OCP\Migration\SimpleMigrationStep;
|
|
|
|
class Version020600Date20250704145036 extends SimpleMigrationStep {
|
|
|
|
/**
|
|
* @param IOutput $output
|
|
* @param Closure(): ISchemaWrapper $schemaClosure
|
|
* @param array $options
|
|
* @return null|ISchemaWrapper
|
|
*/
|
|
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
|
|
/** @var ISchemaWrapper $schema */
|
|
$schema = $schemaClosure();
|
|
$schemaChanged = false;
|
|
|
|
if ($schema->hasTable('assistant_chat_msgs')) {
|
|
$table = $schema->getTable('assistant_chat_msgs');
|
|
if (!$table->hasColumn('attachments')) {
|
|
$table->addColumn('attachments', Types::TEXT, [
|
|
'notnull' => false,
|
|
]);
|
|
$schemaChanged = true;
|
|
}
|
|
}
|
|
|
|
return $schemaChanged ? $schema : null;
|
|
}
|
|
}
|