You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Version1012Date20190808122342.php 3.4KB

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