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.

Version21000Date20201120141228.php 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OC\Core\Migrations;
  8. use Closure;
  9. use OCP\DB\ISchemaWrapper;
  10. use OCP\Migration\IOutput;
  11. use OCP\Migration\SimpleMigrationStep;
  12. class Version21000Date20201120141228 extends SimpleMigrationStep {
  13. public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
  14. /** @var ISchemaWrapper $schema */
  15. $schema = $schemaClosure();
  16. if ($schema->hasTable('authtoken')) {
  17. $table = $schema->getTable('authtoken');
  18. $loginNameColumn = $table->getColumn('login_name');
  19. if ($loginNameColumn->getLength() !== 255) {
  20. $loginNameColumn->setLength(255);
  21. }
  22. $table->changeColumn('type', [
  23. 'notnull' => false,
  24. ]);
  25. $table->changeColumn('remember', [
  26. 'notnull' => false,
  27. ]);
  28. $table->changeColumn('last_activity', [
  29. 'notnull' => false,
  30. ]);
  31. $table->changeColumn('last_check', [
  32. 'notnull' => false,
  33. ]);
  34. }
  35. if ($schema->hasTable('dav_job_status')) {
  36. $schema->dropTable('dav_job_status');
  37. }
  38. if ($schema->hasTable('share')) {
  39. $table = $schema->getTable('share');
  40. if ($table->hasColumn('attributes')) {
  41. $table->dropColumn('attributes');
  42. }
  43. }
  44. if ($schema->hasTable('jobs')) {
  45. $table = $schema->getTable('jobs');
  46. $table->changeColumn('execution_duration', [
  47. 'notnull' => false,
  48. 'default' => 0,
  49. ]);
  50. }
  51. return $schema;
  52. }
  53. }