I am trying to set the allocation size and initial value of a sequence using the IDENTITY strategy for PostgreSQL. This doesn't produce the SQL I expected, changing the strategy to SEQUENCE works however. Is this intended?
id:
id:
type: integer
id: true
generator:
strategy: IDENTITY
sequenceGenerator:
sequenceName: table_id_seq
allocationSize: 10
initialValue: 100000
Doctrine initializes the ID generator strategy in Doctrine\ORM\Mapping\ClassMetadataFactory
. There is a big switch
statement in the factory, switching the <STRATEGY_NAME>
you provide in your YAML configuration:
generator:
strategy: <STRATEGY_NAME>
The selected strategy then fetches further optional parameters from your configuration.
All available strategies are listed in the Doctrine Manual. The options for the Sequence Generator
strategy are detailed in the following subsection.
Judging from your configuration, you are currently setting the parameters for the Sequence Generator
strategy, while telling Doctrine to use the Identifier
strategy. Maybe this is the unexpected behavior you are experiencing?
You may read the source code of the respective factory lines to clarify your expectations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With