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

🏗️ chore(deps): Bump doctrine/dbal from 3.8.3 to 4.0.4 #46192

Draft
wants to merge 51 commits into
base: master
Choose a base branch
from

Conversation

nickvergessen
Copy link
Member

@nickvergessen nickvergessen commented Jun 28, 2024

🔴 Platform requirements

  • Removed support for Oracle 12c (12.2.0.1) and older
  • Removed support for MariaDB 10.4.2 and older
  • Removed support for MySQL 5.6 and older
  • Removed active support for Postgres 9

⛑️ Need Help

⚠️ Breaking API changes

  • Doctrine\DBAL\Platforms\SqlitePlatform was renamed, use \OCP\IDBConnection::getDatabaseProvider() instead
  • Doctrine\DBAL\Platforms\PostgreSQL94Platform was removed, use \OCP\IDBConnection::getDatabaseProvider() instead
  • \OCP\DB\IQueryBuilder::getQueryParts() and \OCP\DB\IQueryBuilder::getQueryPart() were removed
  • \OCP\DB\IQueryBuilder::resetQueryParts() and \OCP\DB\IQueryBuilder::resetQueryPart() can only reset 'where'|'having'|'orderBy'|'groupBy'. For all other cases a new querybuilder has to be created.
  • Doctrine\DBAL\Types\Type::getName() aka. $column->getType()->getName() was removed is removed, use newly added \OCP\DB\Types::getType($column->getType())
  • Doctrine\DBAL\Schema\Table::changeColumn() was removed, use Table::modifyColumn() instead
  • Doctrine\DBAL\Schema\Table::hasPrimaryKey() was removed, use Table::getPrimaryKey() instead
  • Doctrine\DBAL\Schema\Schema::getTableNames() was removed, use OCP\DB\ISchemaWrapper::getTableNames() instead
  • Doctrine\DBAL\Connection::getSchemaManager() was removed, use Connection::createSchemaManager() instead
  • Doctrine\DBAL\FetchMode was removed, please use the dedicated fetch methods instead
  • \OCP\DB\IQueryBuilder::delete() and \OCP\DB\IQueryBuilder::update() no longer support table alias
  • Doctrine\DBAL\Platforms\MySQL80Platform requires the length of a VARCHAR column to be specified - 255 was added
  • OCP\DB\IPreparedStatement::bindParam() is deprecated and calls bindValue() internally
  • OCP\Diagnostics\IQueryLogger no longer extends \Doctrine\DBAL\Logging\SQLLogger
  • OCP\Diagnostics\IQuery data structure is now typed and the structure of the data can have changed depending on the type of the query due to upstream changes
  • OCP\DB\QueryBuilder\IExpressionBuilder::orX() and OCP\DB\QueryBuilder\IExpressionBuilder::andX() can no longer be called without arguments. Create an array outside and only create the composition once you know your entries.
  • Affected row counts are limited to PHP_INT_MAX

Checklist

@susnux

This comment was marked as outdated.

@nickvergessen

This comment was marked as outdated.

@nickvergessen nickvergessen force-pushed the dependabot/composer/doctrine/dbal-4.0.4 branch from f305046 to 3b4d652 Compare July 1, 2024 09:34
@susnux

This comment was marked as outdated.

@nickvergessen

This comment was marked as outdated.

core/Command/Db/ConvertFilecacheBigInt.php Fixed Show fixed Hide fixed
lib/private/DB/MigrationService.php Fixed Show fixed Hide fixed
lib/private/DB/MigrationService.php Fixed Show fixed Hide fixed
lib/private/DB/Migrator.php Fixed Show fixed Hide fixed
lib/private/DB/Migrator.php Fixed Show fixed Hide fixed
@nickvergessen nickvergessen force-pushed the dependabot/composer/doctrine/dbal-4.0.4 branch from ab5e08c to a42453f Compare July 4, 2024 09:33
@nickvergessen nickvergessen requested a review from tcitworld as a code owner July 4, 2024 09:33
Copy link
Contributor

@come-nc come-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the bit of bikeshedding 🙂

core/Command/Db/ConvertType.php Show resolved Hide resolved
lib/private/DB/Connection.php Show resolved Hide resolved
lib/private/DB/Connection.php Show resolved Hide resolved
@@ -1096,18 +1135,20 @@ public function addOrderBy($sort, $order = null) {
* @param string $queryPartName
*
* @return mixed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @return mixed
* @return never

lib/private/DB/ResultAdapter.php Outdated Show resolved Hide resolved
lib/private/DB/SchemaWrapper.php Outdated Show resolved Hide resolved
lib/private/DB/TDoctrineParameterTypeMap.php Outdated Show resolved Hide resolved
@@ -35,7 +35,7 @@ public function setupDatabase($username) {
->andWhere($builder->expr()->eq('rolname', $builder->createNamedParameter($this->dbUser)));

try {
$result = $query->execute();
$result = $query->executeQuery();
$canCreateRoles = $result->rowCount() > 0;
} catch (DatabaseException $e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iirc execute and executeQuery do not throw the same class and this needs to be adapted, same for other similar changes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* @return IResult|int
* @throws Exception since 21.0.0
* @since 8.2.0
* @deprecated 22.0.0 Use executeQuery or executeStatement
*/
public function execute();

🆒 how the docs are lying then...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are not, you do need to use executeQuery, but you also need to adapt catch to the wrapped Exception.
I checked and DatabaseException is not part of the wrapped ones, only the dbal exception get wrapped so you should be fine.

Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
…ote()` - saw 2

Signed-off-by: Joas Schilling <coding@schilljs.com>
…fierQuoteCharacter()` does not exist

Signed-off-by: Joas Schilling <coding@schilljs.com>
…tBitAndComparisonExpression` expects string

Signed-off-by: Joas Schilling <coding@schilljs.com>
…calls `bindValue()` internally

Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
…ELETE fails

Signed-off-by: Joas Schilling <coding@schilljs.com>
…on\ExpressionBuilder::or()`, 0 passed and atleast 1 expected

Signed-off-by: Joas Schilling <coding@schilljs.com>
@nickvergessen nickvergessen force-pushed the dependabot/composer/doctrine/dbal-4.0.4 branch from a42453f to 5fdc5d5 Compare July 4, 2024 12:23
@@ -230,18 +238,10 @@
return $this->inner;
}

/**
* @return self::PLATFORM_MYSQL|self::PLATFORM_ORACLE|self::PLATFORM_POSTGRES|self::PLATFORM_SQLITE

Check failure

Code scanning / Psalm

MoreSpecificReturnType Error

The declared return type ''mysql'|'oracle'|'postgres'|'sqlite'' for OC\DB\ConnectionAdapter::getDatabaseProvider is more specific than the inferred return type 'string'
} else {
throw new \Exception('Database ' . $platform::class . ' not supported');
}
return $this->inner->getDatabaseProvider();

Check failure

Code scanning / Psalm

LessSpecificReturnStatement Error

The type 'string' is more general than the declared return type ''mysql'|'oracle'|'postgres'|'sqlite'' for OC\DB\ConnectionAdapter::getDatabaseProvider
use OCP\DB\QueryBuilder\IQueryBuilder;

trait TDoctrineParameterTypeMap {
protected function convertParameterTypeToDoctrine(ArrayParameterType|ParameterType|string|int|null $type): ArrayParameterType|ParameterType|string {

Check failure

Code scanning / Psalm

InvalidReturnType Error

The declared return type 'Doctrine\DBAL\ArrayParameterType|Doctrine\DBAL\ParameterType|string' for OC\DB\TDoctrineParameterTypeMap::convertParameterTypeToDoctrine is incorrect, got 'Doctrine\DBAL\ArrayParameterType|Doctrine\DBAL\ParameterType|int|string'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants