Version1011Date20190806104428.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\DAV\Migration;
  8. use Closure;
  9. use OCP\DB\ISchemaWrapper;
  10. use OCP\DB\Types;
  11. use OCP\Migration\IOutput;
  12. use OCP\Migration\SimpleMigrationStep;
  13. /**
  14. * Auto-generated migration step: Please modify to your needs!
  15. */
  16. class Version1011Date20190806104428 extends SimpleMigrationStep {
  17. /**
  18. * @param IOutput $output
  19. * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
  20. * @param array $options
  21. * @return null|ISchemaWrapper
  22. */
  23. public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
  24. /** @var ISchemaWrapper $schema */
  25. $schema = $schemaClosure();
  26. $table = $schema->createTable('dav_cal_proxy');
  27. $table->addColumn('id', Types::BIGINT, [
  28. 'autoincrement' => true,
  29. 'notnull' => true,
  30. 'length' => 11,
  31. 'unsigned' => true,
  32. ]);
  33. $table->addColumn('owner_id', Types::STRING, [
  34. 'notnull' => true,
  35. 'length' => 64,
  36. ]);
  37. $table->addColumn('proxy_id', Types::STRING, [
  38. 'notnull' => true,
  39. 'length' => 64,
  40. ]);
  41. $table->addColumn('permissions', Types::INTEGER, [
  42. 'notnull' => false,
  43. 'length' => 4,
  44. 'unsigned' => true,
  45. ]);
  46. $table->setPrimaryKey(['id']);
  47. $table->addUniqueIndex(['owner_id', 'proxy_id', 'permissions'], 'dav_cal_proxy_uidx');
  48. $table->addIndex(['proxy_id'], 'dav_cal_proxy_ipid');
  49. return $schema;
  50. }
  51. }