Skip to content

Commit 4a98685

Browse files
committed
feat(migrations): add metadata to existing migrations
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
1 parent aabd6ef commit 4a98685

File tree

5 files changed

+25
-1
lines changed

5 files changed

+25
-1
lines changed

apps/dav/lib/Migration/Version1031Date20240610134258.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@
1212
use Closure;
1313
use OCP\DB\ISchemaWrapper;
1414
use OCP\DB\Types;
15+
use OCP\Migration\Attributes\AddColumn;
16+
use OCP\Migration\Attributes\ColumnType;
1517
use OCP\Migration\IOutput;
1618
use OCP\Migration\SimpleMigrationStep;
1719

20+
#[AddColumn(table: 'dav_absence', name: 'dav_absence', type: ColumnType::STRING)]
21+
#[AddColumn(table: 'dav_absence', name: 'replacement_user_display_name', type: ColumnType::STRING)]
1822
class Version1031Date20240610134258 extends SimpleMigrationStep {
1923
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
2024
/** @var ISchemaWrapper $schema */
@@ -23,7 +27,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
2327
$tableDavAbsence = $schema->getTable('dav_absence');
2428

2529
if (!$tableDavAbsence->hasColumn('replacement_user_id')) {
26-
$tableDavAbsence->addColumn('replacement_user_id', Types::STRING, [
30+
$tableDavAbsence->addColumn('dav_absence', Types::STRING, [
2731
'notnull' => false,
2832
'default' => '',
2933
'length' => 64,

apps/files_trashbin/lib/Migration/Version1020Date20240403003535.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@
1212
use Closure;
1313
use OCP\DB\ISchemaWrapper;
1414
use OCP\DB\Types;
15+
use OCP\Migration\Attributes\AddColumn;
16+
use OCP\Migration\Attributes\ColumnType;
1517
use OCP\Migration\IOutput;
1618
use OCP\Migration\SimpleMigrationStep;
1719

20+
#[AddColumn(table: 'files_trash', name: 'deleted_by', type: ColumnType::STRING)]
1821
class Version1020Date20240403003535 extends SimpleMigrationStep {
1922

2023
/**

core/Migrations/Version30000Date20240429122720.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,20 @@
1111
use Closure;
1212
use OCP\DB\ISchemaWrapper;
1313
use OCP\DB\Types;
14+
use OCP\Migration\Attributes\AddIndex;
15+
use OCP\Migration\Attributes\CreateTable;
16+
use OCP\Migration\Attributes\IndexType;
1417
use OCP\Migration\IOutput;
1518
use OCP\Migration\SimpleMigrationStep;
1619

1720
/**
1821
*
1922
*/
23+
#[CreateTable(table: 'taskprocessing_tasks')]
24+
#[AddIndex(table: 'taskprocessing_tasks', type: IndexType::PRIMARY)]
25+
#[AddIndex(table: 'taskprocessing_tasks', type: IndexType::INDEX)]
26+
#[AddIndex(table: 'taskprocessing_tasks', type: IndexType::INDEX)]
27+
#[AddIndex(table: 'taskprocessing_tasks', type: IndexType::INDEX)]
2028
class Version30000Date20240429122720 extends SimpleMigrationStep {
2129

2230
/**

core/Migrations/Version30000Date20240708160048.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,17 @@
1111
use Closure;
1212
use OCP\DB\ISchemaWrapper;
1313
use OCP\DB\Types;
14+
use OCP\Migration\Attributes\AddColumn;
15+
use OCP\Migration\Attributes\ColumnType;
1416
use OCP\Migration\IOutput;
1517
use OCP\Migration\SimpleMigrationStep;
1618

1719
/**
1820
*
1921
*/
22+
#[AddColumn(table: 'taskprocessing_tasks', name: 'scheduled_at', type: ColumnType::INTEGER)]
23+
#[AddColumn(table: 'taskprocessing_tasks', name: 'started_at', type: ColumnType::INTEGER)]
24+
#[AddColumn(table: 'taskprocessing_tasks', name: 'ended_at', type: ColumnType::INTEGER)]
2025
class Version30000Date20240708160048 extends SimpleMigrationStep {
2126

2227
/**

core/Migrations/Version30000Date20240717111406.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@
1111
use Closure;
1212
use OCP\DB\ISchemaWrapper;
1313
use OCP\DB\Types;
14+
use OCP\Migration\Attributes\AddColumn;
15+
use OCP\Migration\Attributes\ColumnType;
1416
use OCP\Migration\IOutput;
1517
use OCP\Migration\SimpleMigrationStep;
1618

1719
/**
1820
*
1921
*/
22+
#[AddColumn(table: 'taskprocessing_tasks', name: 'webhook_uri', type: ColumnType::STRING)]
23+
#[AddColumn(table: 'taskprocessing_tasks', name: 'webhook_method', type: ColumnType::STRING)]
2024
class Version30000Date20240717111406 extends SimpleMigrationStep {
2125

2226
/**

0 commit comments

Comments
 (0)