refs #309 make encoded_icon columns larger

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
This commit is contained in:
Julien Veyssier
2024-10-27 16:46:37 +01:00
parent 5912b815c3
commit 274513b3b9
2 changed files with 50 additions and 1 deletions

View File

@@ -3,7 +3,7 @@
<id>cospend</id>
<name>Cospend</name>
<summary> </summary><description> </description>
<version>3.0.2</version>
<version>3.0.3</version>
<licence>agpl</licence>
<author mail="julien-nc@posteo.net">Julien Veyssier</author>
<namespace>Cospend</namespace>

View File

@@ -0,0 +1,49 @@
<?php
declare(strict_types=1);
namespace OCA\Cospend\Migration;
use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
class Version030003Date20241027164309 extends SimpleMigrationStep {
public function __construct() {
}
/**
* @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();
$schemaChanged = false;
if ($schema->hasTable('cospend_categories')) {
$table = $schema->getTable('cospend_categories');
if ($table->hasColumn('encoded_icon')) {
$column = $table->getColumn('encoded_icon');
$column->setLength(256);
$schemaChanged = true;
}
}
if ($schema->hasTable('cospend_paymentmodes')) {
$table = $schema->getTable('cospend_paymentmodes');
if ($table->hasColumn('encoded_icon')) {
$column = $table->getColumn('encoded_icon');
$column->setLength(256);
$schemaChanged = true;
}
}
return $schemaChanged ? $schema : null;
}
}