1
0

Version13000Date20170814074715.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OC\Core\Migrations;
  7. use OCP\DB\ISchemaWrapper;
  8. use OCP\Migration\IOutput;
  9. use OCP\Migration\SimpleMigrationStep;
  10. class Version13000Date20170814074715 extends SimpleMigrationStep {
  11. /**
  12. * @param IOutput $output
  13. * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
  14. * @param array $options
  15. * @since 13.0.0
  16. */
  17. public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
  18. }
  19. /**
  20. * @param IOutput $output
  21. * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
  22. * @param array $options
  23. * @return null|ISchemaWrapper
  24. * @since 13.0.0
  25. */
  26. public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
  27. /** @var ISchemaWrapper $schema */
  28. $schema = $schemaClosure();
  29. if (!$schema->hasTable('accounts')) {
  30. $table = $schema->createTable('accounts');
  31. $table->addColumn('uid', 'string', [
  32. 'notnull' => true,
  33. 'length' => 64,
  34. 'default' => '',
  35. ]);
  36. $table->addColumn('data', 'text', [
  37. 'notnull' => true,
  38. 'default' => '',
  39. ]);
  40. $table->setPrimaryKey(['uid']);
  41. }
  42. return $schema;
  43. }
  44. /**
  45. * @param IOutput $output
  46. * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
  47. * @param array $options
  48. * @since 13.0.0
  49. */
  50. public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
  51. }
  52. }