1
0

Version1020Date20240403003535.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\Files_Trashbin\Migration;
  8. use Closure;
  9. use OCP\DB\ISchemaWrapper;
  10. use OCP\DB\Types;
  11. use OCP\Migration\Attributes\AddColumn;
  12. use OCP\Migration\Attributes\ColumnType;
  13. use OCP\Migration\IOutput;
  14. use OCP\Migration\SimpleMigrationStep;
  15. #[AddColumn(table: 'files_trash', name: 'deleted_by', type: ColumnType::STRING)]
  16. class Version1020Date20240403003535 extends SimpleMigrationStep {
  17. /**
  18. * @param Closure(): ISchemaWrapper $schemaClosure
  19. */
  20. public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
  21. /** @var ISchemaWrapper $schema */
  22. $schema = $schemaClosure();
  23. if (!$schema->hasTable('files_trash')) {
  24. return null;
  25. }
  26. $table = $schema->getTable('files_trash');
  27. $table->addColumn('deleted_by', Types::STRING, [
  28. 'notnull' => false,
  29. 'length' => 64,
  30. ]);
  31. return $schema;
  32. }
  33. }