Thanasoft-H2F/gestion/lib/Migration/Version20104Date20220728143910.php
2024-12-10 13:55:23 +03:00

52 lines
1.5 KiB
PHP

<?php
declare(strict_types=1);
namespace OCA\Gestion\Migration;
use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
/**
* Auto-generated migration step: Please modify to your needs!
*/
class Version20104Date20220728143910 extends SimpleMigrationStep {
/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
*/
public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
}
/**
* @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 {
$schema = $schemaClosure();
$tableprefix = "gestion_";
$table = $schema->getTable($tableprefix.'produit_devis');
if (!$table->hasColumn('comment')) {
$table->addColumn('comment', 'string', ['notnull' => false, 'default' => "-"]);
}else if ($table->hasColumn('comment')) {
$column = $table->getColumn('comment');
$column->setOptions(['type' => \Doctrine\DBAL\Types\Type::getType('string'), 'notnull' => false, 'default' => "-"]);
}
return $schema;
}
/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
*/
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
}
}