Version19000Date20200211083441.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 Version19000Date20200211083441 extends SimpleMigrationStep {
  13. public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
  14. /** @var ISchemaWrapper $schema */
  15. $schema = $schemaClosure();
  16. if (!$schema->hasTable('webauthn')) {
  17. $table = $schema->createTable('webauthn');
  18. $table->addColumn('id', 'integer', [
  19. 'autoincrement' => true,
  20. 'notnull' => true,
  21. 'length' => 64,
  22. ]);
  23. $table->addColumn('uid', 'string', [
  24. 'notnull' => true,
  25. 'length' => 64,
  26. ]);
  27. $table->addColumn('name', 'string', [
  28. 'notnull' => true,
  29. 'length' => 64,
  30. ]);
  31. $table->addColumn('public_key_credential_id', 'string', [
  32. 'notnull' => true,
  33. 'length' => 512
  34. ]);
  35. $table->addColumn('data', 'text', [
  36. 'notnull' => true,
  37. ]);
  38. $table->setPrimaryKey(['id']);
  39. $table->addIndex(['uid'], 'webauthn_uid');
  40. $table->addIndex(['public_key_credential_id'], 'webauthn_publicKeyCredentialId');
  41. }
  42. return $schema;
  43. }
  44. }