Skip to content

Commit

Permalink
refs #309 make encoded_icon columns larger
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Veyssier <[email protected]>
  • Loading branch information
julien-nc committed Oct 27, 2024
1 parent 5912b81 commit 274513b
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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="[email protected]">Julien Veyssier</author>
<namespace>Cospend</namespace>
Expand Down
49 changes: 49 additions & 0 deletions lib/Migration/Version030003Date20241027164309.php
Original file line number Diff line number Diff line change
@@ -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;
}
}

0 comments on commit 274513b

Please sign in to comment.