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.

Version14000Date20180522074438.php 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2018 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 Version14000Date20180522074438 extends SimpleMigrationStep {
  13. public function changeSchema(IOutput $output, Closure $schemaClosure,
  14. array $options): ISchemaWrapper {
  15. $schema = $schemaClosure();
  16. if (!$schema->hasTable('twofactor_providers')) {
  17. $table = $schema->createTable('twofactor_providers');
  18. $table->addColumn('provider_id', 'string',
  19. [
  20. 'notnull' => true,
  21. 'length' => 32,
  22. ]);
  23. $table->addColumn('uid', 'string',
  24. [
  25. 'notnull' => true,
  26. 'length' => 64,
  27. ]);
  28. $table->addColumn('enabled', 'smallint',
  29. [
  30. 'notnull' => true,
  31. 'length' => 1,
  32. ]);
  33. $table->setPrimaryKey(['provider_id', 'uid']);
  34. $table->addIndex(['uid'], 'twofactor_providers_uid');
  35. }
  36. return $schema;
  37. }
  38. }