| @@ 31-54 (lines=24) @@ | ||
| 28 | use OCP\Migration\SimpleMigrationStep; |
|
| 29 | use OCP\Migration\IOutput; |
|
| 30 | ||
| 31 | class Version14000Date20180518120534 extends SimpleMigrationStep { |
|
| 32 | ||
| 33 | public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
| 34 | /** @var ISchemaWrapper $schema */ |
|
| 35 | $schema = $schemaClosure(); |
|
| 36 | ||
| 37 | $table = $schema->getTable('authtoken'); |
|
| 38 | $table->addColumn('private_key', 'text', [ |
|
| 39 | 'notnull' => false, |
|
| 40 | ]); |
|
| 41 | $table->addColumn('public_key', 'text', [ |
|
| 42 | 'notnull' => false, |
|
| 43 | ]); |
|
| 44 | $table->addColumn('version', 'smallint', [ |
|
| 45 | 'notnull' => true, |
|
| 46 | 'default' => 1, |
|
| 47 | 'unsigned' => true, |
|
| 48 | ]); |
|
| 49 | $table->addIndex(['uid'], 'authtoken_uid_index'); |
|
| 50 | $table->addIndex(['version'], 'authtoken_version_index'); |
|
| 51 | ||
| 52 | return $schema; |
|
| 53 | } |
|
| 54 | } |
|
| 55 | ||
| @@ 33-63 (lines=31) @@ | ||
| 30 | use OCP\Migration\IOutput; |
|
| 31 | use OCP\Migration\SimpleMigrationStep; |
|
| 32 | ||
| 33 | class Version14000Date20180522074438 extends SimpleMigrationStep { |
|
| 34 | ||
| 35 | public function changeSchema(IOutput $output, Closure $schemaClosure, |
|
| 36 | array $options): ISchemaWrapper { |
|
| 37 | ||
| 38 | $schema = $schemaClosure(); |
|
| 39 | ||
| 40 | if (!$schema->hasTable('twofactor_providers')) { |
|
| 41 | $table = $schema->createTable('twofactor_providers'); |
|
| 42 | $table->addColumn('provider_id', 'string', |
|
| 43 | [ |
|
| 44 | 'notnull' => true, |
|
| 45 | 'length' => 32, |
|
| 46 | ]); |
|
| 47 | $table->addColumn('uid', 'string', |
|
| 48 | [ |
|
| 49 | 'notnull' => true, |
|
| 50 | 'length' => 64, |
|
| 51 | ]); |
|
| 52 | $table->addColumn('enabled', 'smallint', |
|
| 53 | [ |
|
| 54 | 'notnull' => true, |
|
| 55 | 'length' => 1, |
|
| 56 | ]); |
|
| 57 | $table->setPrimaryKey(['provider_id', 'uid']); |
|
| 58 | } |
|
| 59 | ||
| 60 | return $schema; |
|
| 61 | } |
|
| 62 | ||
| 63 | } |
|
| 64 | ||