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

DBAL deprecation: AbstractPlatform::usesSequenceEmulatedIdentityColumns is deprecated #10744

Open
dmaicher opened this issue Jun 2, 2023 · 7 comments

Comments

@dmaicher
Copy link
Contributor

dmaicher commented Jun 2, 2023

I noticed the following deprecation report on my projects:

Doctrine\DBAL\Platforms\AbstractPlatform::usesSequenceEmulatedIdentityColumns is deprecated. (AbstractPlatform.php:3945 called by ClassMetadataFactory.php:622, doctrine/dbal#5513, package doctrine/dbal)

This is caused by

if ($this->getTargetPlatform()->usesSequenceEmulatedIdentityColumns()) {

Is there a way to avoid this deprecation inside ClassMetadataFactory?

@greg0ire
Copy link
Member

greg0ire commented Jun 2, 2023

Cc @ruudk

@greg0ire
Copy link
Member

greg0ire commented Jun 2, 2023

The only way I can think of is making the behavior configurable. Either we continue checking, or we don't based on some boolean defined in the ORM config.

@stof
Copy link
Member

stof commented Jun 2, 2023

This check is necessary to avoid breaking BC in the ORM (see that when this method returns true, we reach a deprecated path).

What we need is to find a way to detect the cases non-deprecated case in a non-deprecated way, to avoid reporting a deprecation in that case.

@greg0ire
Copy link
Member

greg0ire commented Jun 2, 2023

Do you mean reimplementing this with instanceof checks? That does not sound too great 🤔 It would be cool if we could ignore that deprecation, but just once (or rather as many times as going on that codepath). But I don't think doctrine/deprecations allows that. Right now, only end users are supposed to call Deprecation::ignore* I think.

@itinance
Copy link

For what I found in the official documentation, the recommended way of generating Primary Keys with auto-generated values in PostgreSQL is

 integer primary key generated always as identity

See: https://wiki.postgresql.org/wiki/Don%27t_Do_This#Don.27t_use_serial
So no SERIAL, no SEQUENCEs, instead IDENTITY.

The strategy IDENTITY is neither providing this syntax nor usable thanks to deprecated-messages.

Is there anything available that we don't need to patch Migration-Files manually?

@stof
Copy link
Member

stof commented Nov 29, 2023

What we would need for PostgreSQL is updating the PostgreSQLPlatform to use the new way of creating identity columns for PostgreSQL 10+

@greg0ire
Copy link
Member

@itinance I'm afraid you'll be stuck until doctrine/dbal 4 is available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants