diff options
Diffstat (limited to 'lib/public/Migration/Attributes/ModifyColumn.php')
-rw-r--r-- | lib/public/Migration/Attributes/ModifyColumn.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/public/Migration/Attributes/ModifyColumn.php b/lib/public/Migration/Attributes/ModifyColumn.php new file mode 100644 index 00000000000..e73b10478f7 --- /dev/null +++ b/lib/public/Migration/Attributes/ModifyColumn.php @@ -0,0 +1,22 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +namespace OCP\Migration\Attributes; + +use Attribute; + +#[Attribute(Attribute::IS_REPEATABLE | Attribute::TARGET_CLASS)] +class ModifyColumn extends ColumnMigrationAttribute { + public function definition(): string { + $type = is_null($this->getType()) ? '' : ' to ' . $this->getType()->value; + $table = empty($this->getTable()) ? '' : ' from table \'' . $this->getTable() . '\''; + return empty($this->getName()) ? + 'Modification of a column' . $table . $type + : 'Modification of column \'' . $this->getName() . '\'' . $table . $type; + } +} |