Version23000Date20210906132259.php 1.3 KB

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