Skip to content

Commit cb43f1d

Browse files
authored
Merge pull request #61 from LibreCodeCoop/fix/issue-58-active-bool-notnull
fix: avoid install failure with bool active column
2 parents 8abb33e + 40f1f67 commit cb43f1d

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

lib/Migration/Version1000Date20260309120000.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
5454
'unsigned' => true,
5555
]);
5656
$table->addColumn('active', Types::BOOLEAN, [
57+
'notnull' => false,
5758
'default' => true,
5859
]);
5960
$table->addColumn('options', Types::TEXT, [
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
/**
4+
* SPDX-FileCopyrightText: 2026 LibreCode coop and LibreCode contributors
5+
* SPDX-License-Identifier: AGPL-3.0-or-later
6+
*/
7+
8+
declare(strict_types=1);
9+
10+
namespace OCA\ProfileFields\Migration;
11+
12+
use Closure;
13+
use OCP\DB\ISchemaWrapper;
14+
use OCP\Migration\IOutput;
15+
use OCP\Migration\SimpleMigrationStep;
16+
17+
class Version1001Date20260404010000 extends SimpleMigrationStep {
18+
/**
19+
* @param IOutput $output
20+
* @param Closure(): ISchemaWrapper $schemaClosure
21+
* @param array $options
22+
*/
23+
#[\Override]
24+
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
25+
/** @var ISchemaWrapper $schema */
26+
$schema = $schemaClosure();
27+
$table = $schema->getTable('profile_fields_definitions');
28+
29+
$activeColumn = $table->getColumn('active');
30+
if (!$activeColumn->getNotnull()) {
31+
return null;
32+
}
33+
34+
$table->changeColumn('active', [
35+
'notnull' => false,
36+
'default' => true,
37+
]);
38+
39+
return $schema;
40+
}
41+
}

0 commit comments

Comments
 (0)