aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2024-11-04 14:16:40 +0100
committerJoas Schilling <coding@schilljs.com>2024-11-04 14:24:16 +0100
commit8b5964c0bd2e786145bd34ff5a23d47f15df2248 (patch)
treeca24b1fcc73748b1791c8f1bffd1596db4e021cd
parent0319e50ae3fbb398b76e81347187e31d90bdef95 (diff)
downloadnextcloud-server-8b5964c0bd2e786145bd34ff5a23d47f15df2248.tar.gz
nextcloud-server-8b5964c0bd2e786145bd34ff5a23d47f15df2248.zip
fix(owncloud): Fix ownCloud migration with oauth2 appbackport/49075/stable30
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--lib/private/Repair/Owncloud/MigrateOauthTables.php12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/private/Repair/Owncloud/MigrateOauthTables.php b/lib/private/Repair/Owncloud/MigrateOauthTables.php
index e8728cd2f66..600d3fd3ed7 100644
--- a/lib/private/Repair/Owncloud/MigrateOauthTables.php
+++ b/lib/private/Repair/Owncloud/MigrateOauthTables.php
@@ -36,8 +36,7 @@ class MigrateOauthTables implements IRepairStep {
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', [
@@ -58,8 +57,7 @@ class MigrateOauthTables implements IRepairStep {
$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
@@ -103,7 +101,8 @@ class MigrateOauthTables implements IRepairStep {
$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.
@@ -122,8 +121,7 @@ class MigrateOauthTables implements IRepairStep {
->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());