Version1006Date20180619154313.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace OCA\DAV\Migration;
  3. use Doctrine\DBAL\Types\Type;
  4. use OCP\DB\ISchemaWrapper;
  5. use OCP\Migration\SimpleMigrationStep;
  6. use OCP\Migration\IOutput;
  7. /**
  8. * Auto-generated migration step: Please modify to your needs!
  9. */
  10. class Version1006Date20180619154313 extends SimpleMigrationStep {
  11. /**
  12. * @param IOutput $output
  13. * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
  14. * @param array $options
  15. * @return null|ISchemaWrapper
  16. * @since 13.0.0
  17. */
  18. public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
  19. /** @var ISchemaWrapper $schema */
  20. $schema = $schemaClosure();
  21. if (!$schema->hasTable('calendar_invitations')) {
  22. $table = $schema->createTable('calendar_invitations');
  23. $table->addColumn('id', Type::BIGINT, [
  24. 'autoincrement' => true,
  25. 'notnull' => true,
  26. 'length' => 11,
  27. 'unsigned' => true,
  28. ]);
  29. $table->addColumn('uid', Type::STRING, [
  30. 'notnull' => true,
  31. 'length' => 255,
  32. ]);
  33. $table->addColumn('recurrenceid', Type::STRING, [
  34. 'notnull' => false,
  35. 'length' => 255,
  36. ]);
  37. $table->addColumn('attendee', Type::STRING, [
  38. 'notnull' => true,
  39. 'length' => 255,
  40. ]);
  41. $table->addColumn('organizer', Type::STRING, [
  42. 'notnull' => true,
  43. 'length' => 255,
  44. ]);
  45. $table->addColumn('sequence', Type::BIGINT, [
  46. 'notnull' => false,
  47. 'length' => 11,
  48. 'unsigned' => true,
  49. ]);
  50. $table->addColumn('token', Type::STRING, [
  51. 'notnull' => true,
  52. 'length' => 60,
  53. ]);
  54. $table->addColumn('expiration', Type::BIGINT, [
  55. 'notnull' => true,
  56. 'length' => 11,
  57. 'unsigned' => true,
  58. ]);
  59. $table->setPrimaryKey(['id']);
  60. $table->addIndex(['token'], 'calendar_invitation_tokens');
  61. return $schema;
  62. }
  63. }
  64. }