2024-07-17 07:49:11 -04:00
|
|
|
<?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;
|
|
|
|
|
|
2024-07-26 13:35:51 -04:00
|
|
|
/**
|
2024-07-29 07:14:29 -04:00
|
|
|
* attribute on new column creation
|
|
|
|
|
*
|
2024-07-26 13:35:51 -04:00
|
|
|
* @since 30.0.0
|
|
|
|
|
*/
|
2024-07-17 07:49:11 -04:00
|
|
|
#[Attribute(Attribute::IS_REPEATABLE | Attribute::TARGET_CLASS)]
|
|
|
|
|
class AddColumn extends ColumnMigrationAttribute {
|
2024-07-26 13:35:51 -04:00
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
* @since 30.0.0
|
|
|
|
|
*/
|
2024-07-17 07:49:11 -04:00
|
|
|
public function definition(): string {
|
|
|
|
|
$type = is_null($this->getType()) ? '' : ' (' . $this->getType()->value . ')';
|
|
|
|
|
return empty($this->getName()) ?
|
2024-07-29 07:14:29 -04:00
|
|
|
'Addition of a new column' . $type . ' to table \'' . $this->getTable() . '\''
|
|
|
|
|
: 'Addition of column \'' . $this->getName() . '\'' . $type . ' to table \'' . $this->getTable() . '\'';
|
2024-07-17 07:49:11 -04:00
|
|
|
}
|
|
|
|
|
}
|