Skip to content

Commit 32d7459

Browse files
nickvergessenbackportbot[bot]
authored andcommitted
Make is_user_defined nullable so we can store false on oracle
Signed-off-by: Joas Schilling <[email protected]>
1 parent 105fc60 commit 32d7459

File tree

4 files changed

+65
-1
lines changed

4 files changed

+65
-1
lines changed

apps/user_status/composer/composer/autoload_classmap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
'OCA\\UserStatus\\Listener\\UserLiveStatusListener' => $baseDir . '/../lib/Listener/UserLiveStatusListener.php',
2929
'OCA\\UserStatus\\Migration\\Version0001Date20200602134824' => $baseDir . '/../lib/Migration/Version0001Date20200602134824.php',
3030
'OCA\\UserStatus\\Migration\\Version0002Date20200902144824' => $baseDir . '/../lib/Migration/Version0002Date20200902144824.php',
31+
'OCA\\UserStatus\\Migration\\Version1000Date20201111130204' => $baseDir . '/../lib/Migration/Version1000Date20201111130204.php',
3132
'OCA\\UserStatus\\Service\\EmojiService' => $baseDir . '/../lib/Service/EmojiService.php',
3233
'OCA\\UserStatus\\Service\\JSDataService' => $baseDir . '/../lib/Service/JSDataService.php',
3334
'OCA\\UserStatus\\Service\\PredefinedStatusService' => $baseDir . '/../lib/Service/PredefinedStatusService.php',

apps/user_status/composer/composer/autoload_static.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class ComposerStaticInitUserStatus
4343
'OCA\\UserStatus\\Listener\\UserLiveStatusListener' => __DIR__ . '/..' . '/../lib/Listener/UserLiveStatusListener.php',
4444
'OCA\\UserStatus\\Migration\\Version0001Date20200602134824' => __DIR__ . '/..' . '/../lib/Migration/Version0001Date20200602134824.php',
4545
'OCA\\UserStatus\\Migration\\Version0002Date20200902144824' => __DIR__ . '/..' . '/../lib/Migration/Version0002Date20200902144824.php',
46+
'OCA\\UserStatus\\Migration\\Version1000Date20201111130204' => __DIR__ . '/..' . '/../lib/Migration/Version1000Date20201111130204.php',
4647
'OCA\\UserStatus\\Service\\EmojiService' => __DIR__ . '/..' . '/../lib/Service/EmojiService.php',
4748
'OCA\\UserStatus\\Service\\JSDataService' => __DIR__ . '/..' . '/../lib/Service/JSDataService.php',
4849
'OCA\\UserStatus\\Service\\PredefinedStatusService' => __DIR__ . '/..' . '/../lib/Service/PredefinedStatusService.php',

apps/user_status/lib/Migration/Version0001Date20200602134824.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op
6969
'unsigned' => true,
7070
]);
7171
$statusTable->addColumn('is_user_defined', Types::BOOLEAN, [
72-
'notnull' => true,
72+
'notnull' => false,
7373
]);
7474
$statusTable->addColumn('message_id', Types::STRING, [
7575
'notnull' => false,
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* @copyright Copyright (c) 2020 Joas Schilling <[email protected]>
7+
*
8+
* @author Joas Schilling <[email protected]>
9+
*
10+
* @license GNU AGPL version 3 or any later version
11+
*
12+
* This program is free software: you can redistribute it and/or modify
13+
* it under the terms of the GNU Affero General Public License as
14+
* published by the Free Software Foundation, either version 3 of the
15+
* License, or (at your option) any later version.
16+
*
17+
* This program is distributed in the hope that it will be useful,
18+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
* GNU Affero General Public License for more details.
21+
*
22+
* You should have received a copy of the GNU Affero General Public License
23+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
24+
*
25+
*/
26+
27+
namespace OCA\UserStatus\Migration;
28+
29+
use Closure;
30+
use OCP\DB\ISchemaWrapper;
31+
use OCP\Migration\IOutput;
32+
use OCP\Migration\SimpleMigrationStep;
33+
34+
class Version1000Date20201111130204 extends SimpleMigrationStep {
35+
36+
/**
37+
* @param IOutput $output
38+
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
39+
* @param array $options
40+
* @return null|ISchemaWrapper
41+
*/
42+
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
43+
/** @var ISchemaWrapper $schema */
44+
$schema = $schemaClosure();
45+
46+
$result = $this->ensureColumnIsNullable($schema, 'user_status', 'is_user_defined');
47+
48+
return $result ? $schema : null;
49+
}
50+
51+
protected function ensureColumnIsNullable(ISchemaWrapper $schema, string $tableName, string $columnName): bool {
52+
$table = $schema->getTable($tableName);
53+
$column = $table->getColumn($columnName);
54+
55+
if ($column->getNotnull()) {
56+
$column->setNotnull(false);
57+
return true;
58+
}
59+
60+
return false;
61+
}
62+
}

0 commit comments

Comments
 (0)