Version23000Date20210721100600.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OC\Core\Migrations;
  7. use Closure;
  8. use OCP\DB\ISchemaWrapper;
  9. use OCP\Migration\IOutput;
  10. use OCP\Migration\SimpleMigrationStep;
  11. class Version23000Date20210721100600 extends SimpleMigrationStep {
  12. /**
  13. * @param IOutput $output
  14. * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
  15. * @param array $options
  16. * @return null|ISchemaWrapper
  17. */
  18. public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
  19. /** @var ISchemaWrapper $schema */
  20. $schema = $schemaClosure();
  21. if (!$schema->hasTable('authorized_groups')) {
  22. $table = $schema->createTable('authorized_groups');
  23. $table->addColumn('id', 'integer', [
  24. 'autoincrement' => true,
  25. 'notnull' => true,
  26. ]);
  27. $table->addColumn('group_id', 'string', [
  28. 'notnull' => true,
  29. 'length' => 200
  30. ]);
  31. $table->addColumn('class', 'string', [
  32. 'notnull' => true,
  33. 'length' => 200,
  34. ]);
  35. $table->setPrimaryKey(['id']);
  36. $table->addIndex(['group_id'], 'admindel_groupid_idx');
  37. return $schema;
  38. }
  39. }
  40. }