Browse Source
feat(comments): Add a meta data column for comments
feat(comments): Add a meta data column for comments
Signed-off-by: Joas Schilling <coding@schilljs.com>pull/42209/head
No known key found for this signature in database
GPG Key ID: 74434EFE0D2E2205
10 changed files with 152 additions and 40 deletions
-
11apps/dav/tests/unit/Comments/CommentsNodeTest.php
-
67core/Migrations/Version29000Date20231213104850.php
-
1lib/composer/composer/autoload_classmap.php
-
1lib/composer/composer/autoload_static.php
-
29lib/private/Comments/Comment.php
-
48lib/private/Comments/Manager.php
-
19lib/public/Comments/IComment.php
-
8tests/lib/Comments/CommentTest.php
-
6tests/lib/Comments/ManagerTest.php
-
2version.php
@ -0,0 +1,67 @@ |
|||
<?php |
|||
|
|||
declare(strict_types=1); |
|||
|
|||
/** |
|||
* @copyright Copyright (c) 2023 Joas Schilling <coding@schilljs.com> |
|||
* |
|||
* @author Joas Schilling <coding@schilljs.com> |
|||
* |
|||
* @license GNU AGPL version 3 or any later version |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU Affero General Public License as |
|||
* published by the Free Software Foundation, either version 3 of the |
|||
* License, or (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU Affero General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Affero General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
* |
|||
*/ |
|||
|
|||
namespace OC\Core\Migrations; |
|||
|
|||
use Closure; |
|||
use OCP\DB\ISchemaWrapper; |
|||
use OCP\DB\Types; |
|||
use OCP\Migration\IOutput; |
|||
use OCP\Migration\SimpleMigrationStep; |
|||
|
|||
class Version29000Date20231213104850 extends SimpleMigrationStep { |
|||
/** |
|||
* @param IOutput $output |
|||
* @param Closure(): ISchemaWrapper $schemaClosure |
|||
* @param array $options |
|||
* @return null|ISchemaWrapper |
|||
*/ |
|||
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|||
/** @var ISchemaWrapper $schema */ |
|||
$schema = $schemaClosure(); |
|||
|
|||
$table = $schema->getTable('comments'); |
|||
$modified = false; |
|||
|
|||
if (!$table->hasColumn('reference_id')) { |
|||
$modified = true; |
|||
$table->addColumn('reference_id', Types::STRING, [ |
|||
'notnull' => false, |
|||
'length' => 64, |
|||
]); |
|||
} |
|||
|
|||
if (!$table->hasColumn('meta_data')) { |
|||
$modified = true; |
|||
$table->addColumn('meta_data', Types::TEXT, [ |
|||
'notnull' => false, |
|||
'default' => '', |
|||
]); |
|||
} |
|||
|
|||
return $modified ? $schema : null; |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue