Version1006Date20180619154313.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. /**
  3. *
  4. *
  5. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  6. * @author Georg Ehrke <oc.list@georgehrke.com>
  7. * @author Joas Schilling <coding@schilljs.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 Version1006Date20180619154313 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 13.0.0
  41. */
  42. public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
  43. /** @var ISchemaWrapper $schema */
  44. $schema = $schemaClosure();
  45. if (!$schema->hasTable('calendar_invitations')) {
  46. $table = $schema->createTable('calendar_invitations');
  47. $table->addColumn('id', Type::BIGINT, [
  48. 'autoincrement' => true,
  49. 'notnull' => true,
  50. 'length' => 11,
  51. 'unsigned' => true,
  52. ]);
  53. $table->addColumn('uid', Type::STRING, [
  54. 'notnull' => true,
  55. 'length' => 255,
  56. ]);
  57. $table->addColumn('recurrenceid', Type::STRING, [
  58. 'notnull' => false,
  59. 'length' => 255,
  60. ]);
  61. $table->addColumn('attendee', Type::STRING, [
  62. 'notnull' => true,
  63. 'length' => 255,
  64. ]);
  65. $table->addColumn('organizer', Type::STRING, [
  66. 'notnull' => true,
  67. 'length' => 255,
  68. ]);
  69. $table->addColumn('sequence', Type::BIGINT, [
  70. 'notnull' => false,
  71. 'length' => 11,
  72. 'unsigned' => true,
  73. ]);
  74. $table->addColumn('token', Type::STRING, [
  75. 'notnull' => true,
  76. 'length' => 60,
  77. ]);
  78. $table->addColumn('expiration', Type::BIGINT, [
  79. 'notnull' => true,
  80. 'length' => 11,
  81. 'unsigned' => true,
  82. ]);
  83. $table->setPrimaryKey(['id']);
  84. $table->addIndex(['token'], 'calendar_invitation_tokens');
  85. return $schema;
  86. }
  87. }
  88. }