Skip to content

Commit 71cd97c

Browse files
Merge pull request #38556 from nextcloud/techdebt/noid/doctrine/dbal-to-3.6.2
chore(deps): Bump doctrine/dbal to 3.7.x
2 parents d061e05 + 570159e commit 71cd97c

File tree

16 files changed

+111
-500
lines changed

16 files changed

+111
-500
lines changed

3rdparty

Submodule 3rdparty updated 287 files
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
#[\Attribute(Attribute::TARGET_PARAMETER)]
4+
class SensitiveParameter {
5+
}

lib/composer/composer/autoload_classmap.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,14 +1194,12 @@
11941194
'OC\\DB\\MissingColumnInformation' => $baseDir . '/lib/private/DB/MissingColumnInformation.php',
11951195
'OC\\DB\\MissingIndexInformation' => $baseDir . '/lib/private/DB/MissingIndexInformation.php',
11961196
'OC\\DB\\MissingPrimaryKeyInformation' => $baseDir . '/lib/private/DB/MissingPrimaryKeyInformation.php',
1197-
'OC\\DB\\MySQLMigrator' => $baseDir . '/lib/private/DB/MySQLMigrator.php',
11981197
'OC\\DB\\MySqlTools' => $baseDir . '/lib/private/DB/MySqlTools.php',
11991198
'OC\\DB\\OCSqlitePlatform' => $baseDir . '/lib/private/DB/OCSqlitePlatform.php',
12001199
'OC\\DB\\ObjectParameter' => $baseDir . '/lib/private/DB/ObjectParameter.php',
12011200
'OC\\DB\\OracleConnection' => $baseDir . '/lib/private/DB/OracleConnection.php',
12021201
'OC\\DB\\OracleMigrator' => $baseDir . '/lib/private/DB/OracleMigrator.php',
12031202
'OC\\DB\\PgSqlTools' => $baseDir . '/lib/private/DB/PgSqlTools.php',
1204-
'OC\\DB\\PostgreSqlMigrator' => $baseDir . '/lib/private/DB/PostgreSqlMigrator.php',
12051203
'OC\\DB\\PreparedStatement' => $baseDir . '/lib/private/DB/PreparedStatement.php',
12061204
'OC\\DB\\QueryBuilder\\CompositeExpression' => $baseDir . '/lib/private/DB/QueryBuilder/CompositeExpression.php',
12071205
'OC\\DB\\QueryBuilder\\ExpressionBuilder\\ExpressionBuilder' => $baseDir . '/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php',
@@ -1594,7 +1592,6 @@
15941592
'OC\\Repair\\RepairDavShares' => $baseDir . '/lib/private/Repair/RepairDavShares.php',
15951593
'OC\\Repair\\RepairInvalidShares' => $baseDir . '/lib/private/Repair/RepairInvalidShares.php',
15961594
'OC\\Repair\\RepairMimeTypes' => $baseDir . '/lib/private/Repair/RepairMimeTypes.php',
1597-
'OC\\Repair\\SqliteAutoincrement' => $baseDir . '/lib/private/Repair/SqliteAutoincrement.php',
15981595
'OC\\RichObjectStrings\\Validator' => $baseDir . '/lib/private/RichObjectStrings/Validator.php',
15991596
'OC\\Route\\CachingRouter' => $baseDir . '/lib/private/Route/CachingRouter.php',
16001597
'OC\\Route\\Route' => $baseDir . '/lib/private/Route/Route.php',

lib/composer/composer/autoload_static.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,14 +1227,12 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
12271227
'OC\\DB\\MissingColumnInformation' => __DIR__ . '/../../..' . '/lib/private/DB/MissingColumnInformation.php',
12281228
'OC\\DB\\MissingIndexInformation' => __DIR__ . '/../../..' . '/lib/private/DB/MissingIndexInformation.php',
12291229
'OC\\DB\\MissingPrimaryKeyInformation' => __DIR__ . '/../../..' . '/lib/private/DB/MissingPrimaryKeyInformation.php',
1230-
'OC\\DB\\MySQLMigrator' => __DIR__ . '/../../..' . '/lib/private/DB/MySQLMigrator.php',
12311230
'OC\\DB\\MySqlTools' => __DIR__ . '/../../..' . '/lib/private/DB/MySqlTools.php',
12321231
'OC\\DB\\OCSqlitePlatform' => __DIR__ . '/../../..' . '/lib/private/DB/OCSqlitePlatform.php',
12331232
'OC\\DB\\ObjectParameter' => __DIR__ . '/../../..' . '/lib/private/DB/ObjectParameter.php',
12341233
'OC\\DB\\OracleConnection' => __DIR__ . '/../../..' . '/lib/private/DB/OracleConnection.php',
12351234
'OC\\DB\\OracleMigrator' => __DIR__ . '/../../..' . '/lib/private/DB/OracleMigrator.php',
12361235
'OC\\DB\\PgSqlTools' => __DIR__ . '/../../..' . '/lib/private/DB/PgSqlTools.php',
1237-
'OC\\DB\\PostgreSqlMigrator' => __DIR__ . '/../../..' . '/lib/private/DB/PostgreSqlMigrator.php',
12381236
'OC\\DB\\PreparedStatement' => __DIR__ . '/../../..' . '/lib/private/DB/PreparedStatement.php',
12391237
'OC\\DB\\QueryBuilder\\CompositeExpression' => __DIR__ . '/../../..' . '/lib/private/DB/QueryBuilder/CompositeExpression.php',
12401238
'OC\\DB\\QueryBuilder\\ExpressionBuilder\\ExpressionBuilder' => __DIR__ . '/../../..' . '/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php',
@@ -1627,7 +1625,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
16271625
'OC\\Repair\\RepairDavShares' => __DIR__ . '/../../..' . '/lib/private/Repair/RepairDavShares.php',
16281626
'OC\\Repair\\RepairInvalidShares' => __DIR__ . '/../../..' . '/lib/private/Repair/RepairInvalidShares.php',
16291627
'OC\\Repair\\RepairMimeTypes' => __DIR__ . '/../../..' . '/lib/private/Repair/RepairMimeTypes.php',
1630-
'OC\\Repair\\SqliteAutoincrement' => __DIR__ . '/../../..' . '/lib/private/Repair/SqliteAutoincrement.php',
16311628
'OC\\RichObjectStrings\\Validator' => __DIR__ . '/../../..' . '/lib/private/RichObjectStrings/Validator.php',
16321629
'OC\\Route\\CachingRouter' => __DIR__ . '/../../..' . '/lib/private/Route/CachingRouter.php',
16331630
'OC\\Route\\Route' => __DIR__ . '/../../..' . '/lib/private/Route/Route.php',

lib/private/DB/Connection.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
use Doctrine\DBAL\Exception;
4343
use Doctrine\DBAL\Platforms\MySQLPlatform;
4444
use Doctrine\DBAL\Platforms\OraclePlatform;
45-
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
4645
use Doctrine\DBAL\Platforms\SqlitePlatform;
4746
use Doctrine\DBAL\Result;
4847
use Doctrine\DBAL\Schema\Schema;
@@ -600,10 +599,6 @@ private function getMigrator() {
600599
return new SQLiteMigrator($this, $config, $dispatcher);
601600
} elseif ($platform instanceof OraclePlatform) {
602601
return new OracleMigrator($this, $config, $dispatcher);
603-
} elseif ($platform instanceof MySQLPlatform) {
604-
return new MySQLMigrator($this, $config, $dispatcher);
605-
} elseif ($platform instanceof PostgreSQL94Platform) {
606-
return new PostgreSqlMigrator($this, $config, $dispatcher);
607602
} else {
608603
return new Migrator($this, $config, $dispatcher);
609604
}

lib/private/DB/Migrator.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
use Doctrine\DBAL\Exception;
3232
use Doctrine\DBAL\Platforms\MySQLPlatform;
3333
use Doctrine\DBAL\Schema\AbstractAsset;
34-
use Doctrine\DBAL\Schema\Comparator;
3534
use Doctrine\DBAL\Schema\Schema;
3635
use Doctrine\DBAL\Schema\SchemaDiff;
3736
use Doctrine\DBAL\Types\StringType;
@@ -75,7 +74,7 @@ public function generateChangeScript(Schema $targetSchema) {
7574
$schemaDiff = $this->getDiff($targetSchema, $this->connection);
7675

7776
$script = '';
78-
$sqls = $schemaDiff->toSql($this->connection->getDatabasePlatform());
77+
$sqls = $this->connection->getDatabasePlatform()->getAlterSchemaSQL($schemaDiff);
7978
foreach ($sqls as $sql) {
8079
$script .= $this->convertStatementToScript($sql);
8180
}
@@ -95,18 +94,20 @@ public function createSchema() {
9594
}
9695
return preg_match($filterExpression, $asset) === 1;
9796
});
98-
return $this->connection->getSchemaManager()->createSchema();
97+
return $this->connection->createSchemaManager()->introspectSchema();
9998
}
10099

101100
/**
102101
* @return SchemaDiff
103102
*/
104103
protected function getDiff(Schema $targetSchema, Connection $connection) {
105-
// adjust varchar columns with a length higher then getVarcharMaxLength to clob
104+
// Adjust STRING columns with a length higher than 4000 to TEXT (clob)
105+
// for consistency between the supported databases and
106+
// old vs. new installations.
106107
foreach ($targetSchema->getTables() as $table) {
107108
foreach ($table->getColumns() as $column) {
108109
if ($column->getType() instanceof StringType) {
109-
if ($column->getLength() > $connection->getDatabasePlatform()->getVarcharMaxLength()) {
110+
if ($column->getLength() > 4000) {
110111
$column->setType(Type::getType('text'));
111112
$column->setLength(null);
112113
}
@@ -122,7 +123,7 @@ protected function getDiff(Schema $targetSchema, Connection $connection) {
122123
}
123124
return preg_match($filterExpression, $asset) === 1;
124125
});
125-
$sourceSchema = $connection->getSchemaManager()->createSchema();
126+
$sourceSchema = $connection->createSchemaManager()->introspectSchema();
126127

127128
// remove tables we don't know about
128129
foreach ($sourceSchema->getTables() as $table) {
@@ -137,9 +138,8 @@ protected function getDiff(Schema $targetSchema, Connection $connection) {
137138
}
138139
}
139140

140-
/** @psalm-suppress InternalMethod */
141-
$comparator = new Comparator();
142-
return $comparator->compare($sourceSchema, $targetSchema);
141+
$comparator = $connection->createSchemaManager()->createComparator();
142+
return $comparator->compareSchemas($sourceSchema, $targetSchema);
143143
}
144144

145145
/**
@@ -155,7 +155,7 @@ protected function applySchema(Schema $targetSchema, Connection $connection = nu
155155
if (!$connection->getDatabasePlatform() instanceof MySQLPlatform) {
156156
$connection->beginTransaction();
157157
}
158-
$sqls = $schemaDiff->toSql($connection->getDatabasePlatform());
158+
$sqls = $connection->getDatabasePlatform()->getAlterSchemaSQL($schemaDiff);
159159
$step = 0;
160160
foreach ($sqls as $sql) {
161161
$this->emit($sql, $step++, count($sqls));
@@ -178,7 +178,7 @@ protected function convertStatementToScript($statement) {
178178
}
179179

180180
protected function getFilterExpression() {
181-
return '/^' . preg_quote($this->config->getSystemValueString('dbtableprefix', 'oc_')) . '/';
181+
return '/^' . preg_quote($this->config->getSystemValueString('dbtableprefix', 'oc_'), '/') . '/';
182182
}
183183

184184
protected function emit(string $sql, int $step, int $max): void {

lib/private/DB/MySQLMigrator.php

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)