IMigrationStep.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
  5. *
  6. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  7. * @author Joas Schilling <coding@schilljs.com>
  8. * @author Robin Appelman <robin@icewind.nl>
  9. *
  10. * @license GNU AGPL version 3 or any later version
  11. *
  12. * This program is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License as
  14. * published by the Free Software Foundation, either version 3 of the
  15. * License, or (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  24. *
  25. */
  26. namespace OCP\Migration;
  27. use Closure;
  28. use OCP\DB\ISchemaWrapper;
  29. /**
  30. * @since 13.0.0
  31. */
  32. interface IMigrationStep {
  33. /**
  34. * Human-readable name of the migration step
  35. *
  36. * @return string
  37. * @since 14.0.0
  38. */
  39. public function name(): string;
  40. /**
  41. * Human-readable description of the migration step
  42. *
  43. * @return string
  44. * @since 14.0.0
  45. */
  46. public function description(): string;
  47. /**
  48. * @param IOutput $output
  49. * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
  50. * @psalm-param Closure():ISchemaWrapper $schemaClosure
  51. * @param array $options
  52. * @since 13.0.0
  53. */
  54. public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options);
  55. /**
  56. * @param IOutput $output
  57. * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
  58. * @psalm-param Closure():ISchemaWrapper $schemaClosure
  59. * @param array $options
  60. * @return null|ISchemaWrapper
  61. * @since 13.0.0
  62. */
  63. public function changeSchema(IOutput $output, Closure $schemaClosure, array $options);
  64. /**
  65. * @param IOutput $output
  66. * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
  67. * @psalm-param Closure():ISchemaWrapper $schemaClosure
  68. * @param array $options
  69. * @since 13.0.0
  70. */
  71. public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options);
  72. }