1
0

Version1012Date20190808122342.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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 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 Doctrine\DBAL\Types\Type;
  28. use OCP\DB\ISchemaWrapper;
  29. use OCP\Migration\IOutput;
  30. use OCP\Migration\SimpleMigrationStep;
  31. /**
  32. * Auto-generated migration step: Please modify to your needs!
  33. */
  34. class Version1012Date20190808122342 extends SimpleMigrationStep {
  35. /**
  36. * @param IOutput $output
  37. * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
  38. * @param array $options
  39. * @return null|ISchemaWrapper
  40. * @since 17.0.0
  41. */
  42. public function changeSchema(IOutput $output,
  43. \Closure $schemaClosure,
  44. array $options):?ISchemaWrapper {
  45. /** @var ISchemaWrapper $schema */
  46. $schema = $schemaClosure();
  47. if (!$schema->hasTable('calendar_reminders')) {
  48. $table = $schema->createTable('calendar_reminders');
  49. $table->addColumn('id', Type::BIGINT, [
  50. 'autoincrement' => true,
  51. 'notnull' => true,
  52. 'length' => 11,
  53. 'unsigned' => true,
  54. ]);
  55. $table->addColumn('calendar_id', Type::BIGINT, [
  56. 'notnull' => true,
  57. 'length' => 11,
  58. ]);
  59. $table->addColumn('object_id', Type::BIGINT, [
  60. 'notnull' => true,
  61. 'length' => 11,
  62. ]);
  63. $table->addColumn('is_recurring', Type::SMALLINT, [
  64. 'notnull' => true,
  65. 'length' => 1,
  66. ]);
  67. $table->addColumn('uid', Type::STRING, [
  68. 'notnull' => true,
  69. 'length' => 255,
  70. ]);
  71. $table->addColumn('recurrence_id', Type::BIGINT, [
  72. 'notnull' => false,
  73. 'length' => 11,
  74. 'unsigned' => true,
  75. ]);
  76. $table->addColumn('is_recurrence_exception', Type::SMALLINT, [
  77. 'notnull' => true,
  78. 'length' => 1,
  79. ]);
  80. $table->addColumn('event_hash', Type::STRING, [
  81. 'notnull' => true,
  82. 'length' => 255,
  83. ]);
  84. $table->addColumn('alarm_hash', Type::STRING, [
  85. 'notnull' => true,
  86. 'length' => 255,
  87. ]);
  88. $table->addColumn('type', Type::STRING, [
  89. 'notnull' => true,
  90. 'length' => 255,
  91. ]);
  92. $table->addColumn('is_relative', Type::SMALLINT, [
  93. 'notnull' => true,
  94. 'length' => 1,
  95. ]);
  96. $table->addColumn('notification_date', Type::BIGINT, [
  97. 'notnull' => true,
  98. 'length' => 11,
  99. 'unsigned' => true,
  100. ]);
  101. $table->addColumn('is_repeat_based', Type::SMALLINT, [
  102. 'notnull' => true,
  103. 'length' => 1,
  104. ]);
  105. $table->setPrimaryKey(['id']);
  106. $table->addIndex(['object_id'], 'calendar_reminder_objid');
  107. $table->addIndex(['uid', 'recurrence_id'], 'calendar_reminder_uidrec');
  108. return $schema;
  109. }
  110. return null;
  111. }
  112. }