Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable30] fix(owncloud): Fix ownCloud migration with oauth2 app #49076

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions lib/private/Repair/Owncloud/MigrateOauthTables.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ public function run(IOutput $output) {
return;
}

$output->info("Update the oauth2_access_tokens table schema.");
$schema = new SchemaWrapper($this->db);
$output->info('Update the oauth2_access_tokens table schema.');
$table = $schema->getTable('oauth2_access_tokens');
if (!$table->hasColumn('hashed_code')) {
$table->addColumn('hashed_code', 'string', [
Expand All @@ -58,8 +57,7 @@ public function run(IOutput $output) {
$table->addIndex(['client_id'], 'oauth2_access_client_id_idx');
}

$output->info("Update the oauth2_clients table schema.");
$schema = new SchemaWrapper($this->db);
$output->info('Update the oauth2_clients table schema.');
$table = $schema->getTable('oauth2_clients');
if ($table->getColumn('name')->getLength() !== 64) {
// shorten existing values before resizing the column
Expand Down Expand Up @@ -103,7 +101,8 @@ public function run(IOutput $output) {

$this->db->migrateToSchema($schema->getWrappedSchema());


// Regenerate schema after migrating to it
$schema = new SchemaWrapper($this->db);
if ($schema->getTable('oauth2_clients')->hasColumn('identifier')) {
$output->info("Move identifier column's data to the new client_identifier column.");
// 1. Fetch all [id, identifier] couple.
Expand All @@ -122,8 +121,7 @@ public function run(IOutput $output) {
->executeStatement();
}

$output->info("Drop the identifier column.");
$schema = new SchemaWrapper($this->db);
$output->info('Drop the identifier column.');
$table = $schema->getTable('oauth2_clients');
$table->dropColumn('identifier');
$this->db->migrateToSchema($schema->getWrappedSchema());
Expand Down
Loading