mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
[PR #12148] [MERGED] docs: generation strategies: differences between DBAL 3 and 4 #13521
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/doctrine/orm/pull/12148
Author: @lucasmirloup
Created: 8/26/2025
Status: ✅ Merged
Merged: 8/27/2025
Merged by: @greg0ire
Base:
3.5.x← Head:docs/generation-strategies-dbal-4📝 Commits (2)
c164ae4docs: generation strategies differences between DBAL 3 and 4f7d4e37docs: consistent PostgreSQL's name case📊 Changes
2 files changed (+9 additions, -7 deletions)
View changed files
📝
docs/en/reference/basic-mapping.rst(+7 -5)📝
docs/en/tutorials/getting-started.rst(+2 -2)📄 Description
Hello,
I'm currently updating Doctrine DBAL from version 3 to 4 on an app that uses Doctrine generated ID columns (with no strategy defined, thus using
AUTOif I'm not mistaken) with PostgreSQL 17.I suspect that the generation strategies' documentation for PostgreSQL is outdated or inaccurate, due to changes introduced in / for Doctrine DBAL 4.
Here's a more detailed report / explanation:
I initially encountered database errors about PostgreSQL's
SEQUENCE, and tried tinkering with the strategy, to no avail.I then stumbled upon the following documentation: https://github.com/doctrine/dbal/blob/4.3.x/docs/en/how-to/postgresql-identity-migration.rst
Still, something about the generation strategies' documentation confused me: the documentation claims that no matter Doctrine DBAL's version, the default (
AUTO) strategy on PostgreSQL isSEQUENCE.When tested on my app, either of these 2 lines produce the same database migrations:
but the
SEQUENCEstrategy just seems to remove theDEFAULT:This behavior suggested that the default strategy on PostgreSQL would be
IDENTITYand notSEQUENCE.After digging into the code, it seems to be the case:
NON_IDENTITY_DEFAULT_STRATEGY:21e9fcbfbb/src/Mapping/ClassMetadataFactory.php (L63-L65)21e9fcbfbb/src/Mapping/ClassMetadataFactory.php (L631-L634)IDENTITY:21e9fcbfbb/src/Mapping/ClassMetadataFactory.php (L666)PostgreSQLPlatformthen outputsGENERATED BY DEFAULT AS IDENTITY:1432ec6851/src/Platforms/PostgreSQLPlatform.php (L276)Thank you for reviewing my PR, tell me if there is anything wrong / that can be improved in it 👍
Thank you for all the work you did on Doctrine!
PS : Do these documentation changes need to be backported all the way back to ORM 3.0? The initial commit that introduced this difference seems to date back to ORM 3.0 RC 1:
bdc039fe31🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.