1
0

Version25000Date20220515204012.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * @author Piotr Mrowczynski piotr@owncloud.com
  4. *
  5. * @copyright Copyright (c) 2019, ownCloud GmbH
  6. * @license AGPL-3.0
  7. *
  8. * This code is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Affero General Public License, version 3,
  10. * as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU Affero General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Affero General Public License, version 3,
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>
  19. *
  20. */
  21. namespace OC\Core\Migrations;
  22. use Closure;
  23. use OCP\DB\ISchemaWrapper;
  24. use OCP\DB\Types;
  25. use OCP\Migration\IOutput;
  26. use OCP\Migration\SimpleMigrationStep;
  27. class Version25000Date20220515204012 extends SimpleMigrationStep {
  28. public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
  29. /** @var ISchemaWrapper $schema */
  30. $schema = $schemaClosure();
  31. if ($schema->hasTable('share')) {
  32. $shareTable = $schema->getTable('share');
  33. if (!$shareTable->hasColumn('attributes')) {
  34. $shareTable->addColumn(
  35. 'attributes',
  36. Types::JSON,
  37. [
  38. 'default' => null,
  39. 'notnull' => false
  40. ]
  41. );
  42. }
  43. }
  44. return $schema;
  45. }
  46. }