Version1012Date20190808122342.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\DAV\Migration;
  8. use OCP\DB\ISchemaWrapper;
  9. use OCP\DB\Types;
  10. use OCP\Migration\IOutput;
  11. use OCP\Migration\SimpleMigrationStep;
  12. /**
  13. * Auto-generated migration step: Please modify to your needs!
  14. */
  15. class Version1012Date20190808122342 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 17.0.0
  22. */
  23. public function changeSchema(IOutput $output,
  24. \Closure $schemaClosure,
  25. array $options):?ISchemaWrapper {
  26. /** @var ISchemaWrapper $schema */
  27. $schema = $schemaClosure();
  28. if (!$schema->hasTable('calendar_reminders')) {
  29. $table = $schema->createTable('calendar_reminders');
  30. $table->addColumn('id', Types::BIGINT, [
  31. 'autoincrement' => true,
  32. 'notnull' => true,
  33. 'length' => 11,
  34. 'unsigned' => true,
  35. ]);
  36. $table->addColumn('calendar_id', Types::BIGINT, [
  37. 'notnull' => true,
  38. 'length' => 11,
  39. ]);
  40. $table->addColumn('object_id', Types::BIGINT, [
  41. 'notnull' => true,
  42. 'length' => 11,
  43. ]);
  44. $table->addColumn('is_recurring', Types::SMALLINT, [
  45. 'notnull' => false,
  46. 'length' => 1,
  47. ]);
  48. $table->addColumn('uid', Types::STRING, [
  49. 'notnull' => true,
  50. 'length' => 255,
  51. ]);
  52. $table->addColumn('recurrence_id', Types::BIGINT, [
  53. 'notnull' => false,
  54. 'length' => 11,
  55. 'unsigned' => true,
  56. ]);
  57. $table->addColumn('is_recurrence_exception', Types::SMALLINT, [
  58. 'notnull' => true,
  59. 'length' => 1,
  60. ]);
  61. $table->addColumn('event_hash', Types::STRING, [
  62. 'notnull' => true,
  63. 'length' => 255,
  64. ]);
  65. $table->addColumn('alarm_hash', Types::STRING, [
  66. 'notnull' => true,
  67. 'length' => 255,
  68. ]);
  69. $table->addColumn('type', Types::STRING, [
  70. 'notnull' => true,
  71. 'length' => 255,
  72. ]);
  73. $table->addColumn('is_relative', Types::SMALLINT, [
  74. 'notnull' => true,
  75. 'length' => 1,
  76. ]);
  77. $table->addColumn('notification_date', Types::BIGINT, [
  78. 'notnull' => true,
  79. 'length' => 11,
  80. 'unsigned' => true,
  81. ]);
  82. $table->addColumn('is_repeat_based', Types::SMALLINT, [
  83. 'notnull' => true,
  84. 'length' => 1,
  85. ]);
  86. $table->setPrimaryKey(['id']);
  87. $table->addIndex(['object_id'], 'calendar_reminder_objid');
  88. $table->addIndex(['uid', 'recurrence_id'], 'calendar_reminder_uidrec');
  89. return $schema;
  90. }
  91. return null;
  92. }
  93. }