Skip to content

Commit 7761111

Browse files
committed
feat: add parent_id column in oc_mounts
Signed-off-by: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com>
1 parent 0d48c8c commit 7761111

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
7+
* SPDX-License-Identifier: AGPL-3.0-or-later
8+
*/
9+
10+
namespace OC\Core\Migrations;
11+
12+
use Closure;
13+
use OCP\DB\ISchemaWrapper;
14+
use OCP\Migration\Attributes\AddColumn;
15+
use OCP\Migration\Attributes\ColumnType;
16+
use OCP\Migration\IOutput;
17+
use OCP\Migration\SimpleMigrationStep;
18+
use Override;
19+
20+
#[AddColumn(table: 'mounts', name: 'parent_id', type: ColumnType::INTEGER, description: 'Add parent id to easily find a mount\'s children')]
21+
class Version33000Date20251124143910 extends SimpleMigrationStep {
22+
23+
/**
24+
* @param IOutput $output
25+
* @param Closure(): ISchemaWrapper $schemaClosure
26+
* @param array $options
27+
*/
28+
#[Override]
29+
public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
30+
}
31+
32+
/**
33+
* @param Closure(): ISchemaWrapper $schemaClosure
34+
*/
35+
#[Override]
36+
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
37+
$schema = $schemaClosure();
38+
39+
if ($schema->hasTable('mounts')) {
40+
$table = $schema->getTable('mounts');
41+
$table->addColumn('parent_id', 'integer', [
42+
'length' => 4,
43+
'notnull' => false,
44+
]);
45+
}
46+
47+
return $schema;
48+
}
49+
50+
/**
51+
* @param Closure(): ISchemaWrapper $schemaClosure
52+
*/
53+
#[Override]
54+
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
55+
}
56+
}

lib/composer/composer/autoload_classmap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,6 +1538,7 @@
15381538
'OC\\Core\\Migrations\\Version33000Date20251023110529' => $baseDir . '/core/Migrations/Version33000Date20251023110529.php',
15391539
'OC\\Core\\Migrations\\Version33000Date20251023120529' => $baseDir . '/core/Migrations/Version33000Date20251023120529.php',
15401540
'OC\\Core\\Migrations\\Version33000Date20251106131209' => $baseDir . '/core/Migrations/Version33000Date20251106131209.php',
1541+
'OC\\Core\\Migrations\\Version33000Date20251124143910' => $baseDir . '/core/Migrations/Version33000Date20251124143910.php',
15411542
'OC\\Core\\Notification\\CoreNotifier' => $baseDir . '/core/Notification/CoreNotifier.php',
15421543
'OC\\Core\\ResponseDefinitions' => $baseDir . '/core/ResponseDefinitions.php',
15431544
'OC\\Core\\Service\\CronService' => $baseDir . '/core/Service/CronService.php',

lib/composer/composer/autoload_static.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,6 +1579,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
15791579
'OC\\Core\\Migrations\\Version33000Date20251023110529' => __DIR__ . '/../../..' . '/core/Migrations/Version33000Date20251023110529.php',
15801580
'OC\\Core\\Migrations\\Version33000Date20251023120529' => __DIR__ . '/../../..' . '/core/Migrations/Version33000Date20251023120529.php',
15811581
'OC\\Core\\Migrations\\Version33000Date20251106131209' => __DIR__ . '/../../..' . '/core/Migrations/Version33000Date20251106131209.php',
1582+
'OC\\Core\\Migrations\\Version33000Date20251124143910' => __DIR__ . '/../../..' . '/core/Migrations/Version33000Date20251124143910.php',
15821583
'OC\\Core\\Notification\\CoreNotifier' => __DIR__ . '/../../..' . '/core/Notification/CoreNotifier.php',
15831584
'OC\\Core\\ResponseDefinitions' => __DIR__ . '/../../..' . '/core/ResponseDefinitions.php',
15841585
'OC\\Core\\Service\\CronService' => __DIR__ . '/../../..' . '/core/Service/CronService.php',

0 commit comments

Comments
 (0)