Version1003Date20210809144824.php 1010 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\UserStatus\Migration;
  8. use OCP\DB\ISchemaWrapper;
  9. use OCP\DB\Types;
  10. use OCP\Migration\IOutput;
  11. use OCP\Migration\SimpleMigrationStep;
  12. /**
  13. * @package OCA\UserStatus\Migration
  14. */
  15. class Version1003Date20210809144824 extends SimpleMigrationStep {
  16. /**
  17. * @param IOutput $output
  18. * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
  19. * @param array $options
  20. * @return null|ISchemaWrapper
  21. * @since 23.0.0
  22. */
  23. public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
  24. /** @var ISchemaWrapper $schema */
  25. $schema = $schemaClosure();
  26. $statusTable = $schema->getTable('user_status');
  27. if (!$statusTable->hasColumn('is_backup')) {
  28. $statusTable->addColumn('is_backup', Types::BOOLEAN, [
  29. 'notnull' => false,
  30. 'default' => false,
  31. ]);
  32. }
  33. return $schema;
  34. }
  35. }