1
0

Version1012Date20190808122342.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright 2019, Georg Ehrke <oc.list@georgehrke.com>
  5. *
  6. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  7. * @author Daniel Kesselberg <mail@danielkesselberg.de>
  8. * @author Georg Ehrke <oc.list@georgehrke.com>
  9. * @author Joas Schilling <coding@schilljs.com>
  10. * @author Roeland Jago Douma <roeland@famdouma.nl>
  11. *
  12. * @license GNU AGPL version 3 or any later version
  13. *
  14. * This program is free software: you can redistribute it and/or modify
  15. * it under the terms of the GNU Affero General Public License as
  16. * published by the Free Software Foundation, either version 3 of the
  17. * License, or (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU Affero General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU Affero General Public License
  25. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  26. *
  27. */
  28. namespace OCA\DAV\Migration;
  29. use OCP\DB\ISchemaWrapper;
  30. use OCP\DB\Types;
  31. use OCP\Migration\IOutput;
  32. use OCP\Migration\SimpleMigrationStep;
  33. /**
  34. * Auto-generated migration step: Please modify to your needs!
  35. */
  36. class Version1012Date20190808122342 extends SimpleMigrationStep {
  37. /**
  38. * @param IOutput $output
  39. * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
  40. * @param array $options
  41. * @return null|ISchemaWrapper
  42. * @since 17.0.0
  43. */
  44. public function changeSchema(IOutput $output,
  45. \Closure $schemaClosure,
  46. array $options):?ISchemaWrapper {
  47. /** @var ISchemaWrapper $schema */
  48. $schema = $schemaClosure();
  49. if (!$schema->hasTable('calendar_reminders')) {
  50. $table = $schema->createTable('calendar_reminders');
  51. $table->addColumn('id', Types::BIGINT, [
  52. 'autoincrement' => true,
  53. 'notnull' => true,
  54. 'length' => 11,
  55. 'unsigned' => true,
  56. ]);
  57. $table->addColumn('calendar_id', Types::BIGINT, [
  58. 'notnull' => true,
  59. 'length' => 11,
  60. ]);
  61. $table->addColumn('object_id', Types::BIGINT, [
  62. 'notnull' => true,
  63. 'length' => 11,
  64. ]);
  65. $table->addColumn('is_recurring', Types::SMALLINT, [
  66. 'notnull' => false,
  67. 'length' => 1,
  68. ]);
  69. $table->addColumn('uid', Types::STRING, [
  70. 'notnull' => true,
  71. 'length' => 255,
  72. ]);
  73. $table->addColumn('recurrence_id', Types::BIGINT, [
  74. 'notnull' => false,
  75. 'length' => 11,
  76. 'unsigned' => true,
  77. ]);
  78. $table->addColumn('is_recurrence_exception', Types::SMALLINT, [
  79. 'notnull' => true,
  80. 'length' => 1,
  81. ]);
  82. $table->addColumn('event_hash', Types::STRING, [
  83. 'notnull' => true,
  84. 'length' => 255,
  85. ]);
  86. $table->addColumn('alarm_hash', Types::STRING, [
  87. 'notnull' => true,
  88. 'length' => 255,
  89. ]);
  90. $table->addColumn('type', Types::STRING, [
  91. 'notnull' => true,
  92. 'length' => 255,
  93. ]);
  94. $table->addColumn('is_relative', Types::SMALLINT, [
  95. 'notnull' => true,
  96. 'length' => 1,
  97. ]);
  98. $table->addColumn('notification_date', Types::BIGINT, [
  99. 'notnull' => true,
  100. 'length' => 11,
  101. 'unsigned' => true,
  102. ]);
  103. $table->addColumn('is_repeat_based', Types::SMALLINT, [
  104. 'notnull' => true,
  105. 'length' => 1,
  106. ]);
  107. $table->setPrimaryKey(['id']);
  108. $table->addIndex(['object_id'], 'calendar_reminder_objid');
  109. $table->addIndex(['uid', 'recurrence_id'], 'calendar_reminder_uidrec');
  110. return $schema;
  111. }
  112. return null;
  113. }
  114. }