1
0

Version23000Date20210906132259.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2021 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\DB\Types;
  11. use OCP\Migration\IOutput;
  12. use OCP\Migration\SimpleMigrationStep;
  13. class Version23000Date20210906132259 extends SimpleMigrationStep {
  14. /**
  15. * @param IOutput $output
  16. * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
  17. * @param array $options
  18. * @return null|ISchemaWrapper
  19. */
  20. public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
  21. /**
  22. * Table was missing a primary key
  23. * Therefore it was dropped with Version24000Date20211213081506
  24. * and then recreated with a primary key in Version24000Date20211213081604
  25. */
  26. // /** @var ISchemaWrapper $schema */
  27. // $schema = $schemaClosure();
  28. //
  29. // $hasTable = $schema->hasTable(self::TABLE_NAME);
  30. //
  31. // if (!$hasTable) {
  32. // $table = $schema->createTable(self::TABLE_NAME);
  33. // $table->addColumn('hash', Types::STRING, [
  34. // 'notnull' => true,
  35. // 'length' => 128,
  36. // ]);
  37. // $table->addColumn('delete_after', Types::DATETIME, [
  38. // 'notnull' => true,
  39. // ]);
  40. // $table->addIndex(['hash'], 'ratelimit_hash');
  41. // $table->addIndex(['delete_after'], 'ratelimit_delete_after');
  42. // return $schema;
  43. // }
  44. return null;
  45. }
  46. }