Skip to content

Commit

Permalink
feat(migrations): add metadata to existing migrations
Browse files Browse the repository at this point in the history
Signed-off-by: Maxence Lange <[email protected]>
  • Loading branch information
ArtificialOwl committed Aug 2, 2024
1 parent aabd6ef commit 4a98685
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/dav/lib/Migration/Version1031Date20240610134258.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@
use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\DB\Types;
use OCP\Migration\Attributes\AddColumn;
use OCP\Migration\Attributes\ColumnType;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;

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

if (!$tableDavAbsence->hasColumn('replacement_user_id')) {
$tableDavAbsence->addColumn('replacement_user_id', Types::STRING, [
$tableDavAbsence->addColumn('dav_absence', Types::STRING, [
'notnull' => false,
'default' => '',
'length' => 64,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\DB\Types;
use OCP\Migration\Attributes\AddColumn;
use OCP\Migration\Attributes\ColumnType;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;

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

/**
Expand Down
8 changes: 8 additions & 0 deletions core/Migrations/Version30000Date20240429122720.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,20 @@
use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\DB\Types;
use OCP\Migration\Attributes\AddIndex;
use OCP\Migration\Attributes\CreateTable;
use OCP\Migration\Attributes\IndexType;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;

/**
*
*/
#[CreateTable(table: 'taskprocessing_tasks')]
#[AddIndex(table: 'taskprocessing_tasks', type: IndexType::PRIMARY)]
#[AddIndex(table: 'taskprocessing_tasks', type: IndexType::INDEX)]
#[AddIndex(table: 'taskprocessing_tasks', type: IndexType::INDEX)]
#[AddIndex(table: 'taskprocessing_tasks', type: IndexType::INDEX)]
class Version30000Date20240429122720 extends SimpleMigrationStep {

/**
Expand Down
5 changes: 5 additions & 0 deletions core/Migrations/Version30000Date20240708160048.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@
use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\DB\Types;
use OCP\Migration\Attributes\AddColumn;
use OCP\Migration\Attributes\ColumnType;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;

/**
*
*/
#[AddColumn(table: 'taskprocessing_tasks', name: 'scheduled_at', type: ColumnType::INTEGER)]
#[AddColumn(table: 'taskprocessing_tasks', name: 'started_at', type: ColumnType::INTEGER)]
#[AddColumn(table: 'taskprocessing_tasks', name: 'ended_at', type: ColumnType::INTEGER)]
class Version30000Date20240708160048 extends SimpleMigrationStep {

/**
Expand Down
4 changes: 4 additions & 0 deletions core/Migrations/Version30000Date20240717111406.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@
use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\DB\Types;
use OCP\Migration\Attributes\AddColumn;
use OCP\Migration\Attributes\ColumnType;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;

/**
*
*/
#[AddColumn(table: 'taskprocessing_tasks', name: 'webhook_uri', type: ColumnType::STRING)]
#[AddColumn(table: 'taskprocessing_tasks', name: 'webhook_method', type: ColumnType::STRING)]
class Version30000Date20240717111406 extends SimpleMigrationStep {

/**
Expand Down

0 comments on commit 4a98685

Please sign in to comment.