Version1011Date20190806104428.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. *
  5. *
  6. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  7. * @author Georg Ehrke <oc.list@georgehrke.com>
  8. * @author Roeland Jago Douma <roeland@famdouma.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 OCA\DAV\Migration;
  27. use Closure;
  28. use Doctrine\DBAL\Types\Type;
  29. use OCP\DB\ISchemaWrapper;
  30. use OCP\Migration\IOutput;
  31. use OCP\Migration\SimpleMigrationStep;
  32. /**
  33. * Auto-generated migration step: Please modify to your needs!
  34. */
  35. class Version1011Date20190806104428 extends SimpleMigrationStep {
  36. /**
  37. * @param IOutput $output
  38. * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
  39. * @param array $options
  40. * @return null|ISchemaWrapper
  41. */
  42. public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
  43. /** @var ISchemaWrapper $schema */
  44. $schema = $schemaClosure();
  45. $table = $schema->createTable('dav_cal_proxy');
  46. $table->addColumn('id', Type::BIGINT, [
  47. 'autoincrement' => true,
  48. 'notnull' => true,
  49. 'length' => 11,
  50. 'unsigned' => true,
  51. ]);
  52. $table->addColumn('owner_id', Type::STRING, [
  53. 'notnull' => true,
  54. 'length' => 64,
  55. ]);
  56. $table->addColumn('proxy_id', Type::STRING, [
  57. 'notnull' => true,
  58. 'length' => 64,
  59. ]);
  60. $table->addColumn('permissions', Type::INTEGER, [
  61. 'notnull' => false,
  62. 'length' => 4,
  63. 'unsigned' => true,
  64. ]);
  65. $table->setPrimaryKey(['id']);
  66. $table->addUniqueIndex(['owner_id', 'proxy_id', 'permissions'], 'dav_cal_proxy_uidx');
  67. $table->addIndex(['owner_id'], 'dav_cal_proxy_ioid');
  68. $table->addIndex(['proxy_id'], 'dav_cal_proxy_ipid');
  69. return $schema;
  70. }
  71. }