-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #711 from nextcloud/fix/column-length-clientid-and…
…-secret increased column length for id and secret
- Loading branch information
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OCA\UserOIDC\Migration; | ||
|
||
use Closure; | ||
use OCP\DB\ISchemaWrapper; | ||
use OCP\IDBConnection; | ||
use OCP\Migration\IOutput; | ||
use OCP\Migration\SimpleMigrationStep; | ||
use OCP\Security\ICrypto; | ||
|
||
class Version010304Date20231121102449 extends SimpleMigrationStep { | ||
|
||
/** | ||
* @var IDBConnection | ||
*/ | ||
private $connection; | ||
/** | ||
* @var ICrypto | ||
*/ | ||
private $crypto; | ||
|
||
public function __construct( | ||
IDBConnection $connection, | ||
ICrypto $crypto | ||
) { | ||
$this->connection = $connection; | ||
$this->crypto = $crypto; | ||
} | ||
|
||
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { | ||
/** @var ISchemaWrapper $schema */ | ||
$schema = $schemaClosure(); | ||
|
||
$schemaChanged = false; | ||
foreach (['user_oidc_providers', 'user_oidc_id4me'] as $tableName) { | ||
if ($schema->hasTable($tableName)) { | ||
$table = $schema->getTable($tableName); | ||
if ($table->hasColumn('client_secret')) { | ||
$column = $table->getColumn('client_secret'); | ||
$column->setLength(2048); | ||
$schemaChanged = true; | ||
} | ||
if ($table->hasColumn('client_id')) { | ||
$column = $table->getColumn('client_id'); | ||
$column->setLength(2048); | ||
$schemaChanged = true; | ||
} | ||
} | ||
} | ||
if ($schemaChanged) { | ||
return $schema; | ||
} | ||
return null; | ||
} | ||
} |