Version30000Date20240102030405.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\Testing\Migration;
  8. use Closure;
  9. use OCP\Migration\Attributes\AddColumn;
  10. use OCP\Migration\Attributes\AddIndex;
  11. use OCP\Migration\Attributes\ColumnType;
  12. use OCP\Migration\Attributes\CreateTable;
  13. use OCP\Migration\Attributes\DropColumn;
  14. use OCP\Migration\Attributes\DropIndex;
  15. use OCP\Migration\Attributes\DropTable;
  16. use OCP\Migration\Attributes\IndexType;
  17. use OCP\Migration\Attributes\ModifyColumn;
  18. use OCP\Migration\IOutput;
  19. use OCP\Migration\SimpleMigrationStep;
  20. #[DropTable(table: 'old_table')]
  21. #[CreateTable(table: 'new_table', description: 'Table is used to store things, but also to get more things', notes: ['this is a notice', 'and another one, if really needed'])]
  22. #[AddColumn(table: 'my_table')]
  23. #[AddColumn(table: 'my_table', name: 'another_field')]
  24. #[AddColumn(table: 'other_table', name: 'last_one', type: ColumnType::DATE)]
  25. #[AddIndex(table: 'my_table')]
  26. #[AddIndex(table: 'my_table', type: IndexType::PRIMARY)]
  27. #[DropColumn(table: 'other_table')]
  28. #[DropColumn(table: 'other_table', name: 'old_column', description: 'field is not used anymore and replaced by \'last_one\'')]
  29. #[DropIndex(table: 'other_table')]
  30. #[ModifyColumn(table: 'other_table')]
  31. #[ModifyColumn(table: 'other_table', name: 'this_field')]
  32. #[ModifyColumn(table: 'other_table', name: 'this_field', type: ColumnType::BIGINT)]
  33. class Version30000Date20240102030405 extends SimpleMigrationStep {
  34. public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
  35. return null;
  36. }
  37. }