forked from NuQloud/nc-talk-ai
41 lines
986 B
PHP
41 lines
986 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace OCA\EducAI\Migration;
|
|
|
|
use Closure;
|
|
use OCP\DB\ISchemaWrapper;
|
|
use OCP\DB\Types;
|
|
use OCP\Migration\IOutput;
|
|
use OCP\Migration\SimpleMigrationStep;
|
|
|
|
class Version024000Date20260901000000 extends SimpleMigrationStep {
|
|
/**
|
|
* @param Closure(): ISchemaWrapper $schemaClosure
|
|
* @param array<string,mixed> $options
|
|
*/
|
|
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
|
|
$schema = $schemaClosure();
|
|
if (!$schema->hasTable('educai_settings')) {
|
|
return $schema;
|
|
}
|
|
|
|
$table = $schema->getTable('educai_settings');
|
|
if (!$table->hasColumn('bot_creation_restricted')) {
|
|
$table->addColumn('bot_creation_restricted', Types::BOOLEAN, [
|
|
'notnull' => true,
|
|
'default' => false,
|
|
]);
|
|
}
|
|
if (!$table->hasColumn('bot_creation_group')) {
|
|
$table->addColumn('bot_creation_group', Types::STRING, [
|
|
'notnull' => false,
|
|
'length' => 255,
|
|
]);
|
|
}
|
|
|
|
return $schema;
|
|
}
|
|
}
|