[DBAL-505] Issue whenusing serial columns in PostgreSQL Created: 24/Apr/13  Updated: 22/Dec/13  Resolved: 22/Dec/13

Status: Resolved
Project: Doctrine DBAL
Component/s: Drivers, Platforms, Schema Managers
Affects Version/s: 2.3.3
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: jos de witte Assignee: Benjamin Eberlei
Resolution: Cannot Reproduce Votes: 0
Labels: None



When using Doctrine ORM mapping fields like this:


  • @var integer
  • @ORM\Column(name="id", type="integer", nullable=false)
  • @ORM\Id
  • @ORM\GeneratedValue(strategy="IDENTITY")
  • @ORM\SequenceGenerator(sequenceName="schemaname.tablename_id_seq", allocationSize=1, initialValue=1)
    private $id;

It first creates the migration perfectly as a serial column with the correct schema.

However when making a new migration diff it generates DROP statements for every sequence for these id, so we have to remove them manually every time.

Comment by Steve Müller [ 19/Dec/13 ]

I think this has been fixed in this commit: https://github.com/Alan01252/dbal/commit/79e894b4493937c0a6eae2e1c8206b188ac2eb7c
Can you please check if the issue still exists on the current master branch? Thank you.

Comment by Benjamin Eberlei [ 22/Dec/13 ]

Tried to reproduce even with the schema name, this seems fixed by the commit Steve Müller showed. However this might exist because of the SequenceGenerator line. Can you remove that one? you don't need it with "IDENTITY".

Closing, please reopen when problem persists.

Generated at Tue Dec 01 02:31:45 EST 2015 using JIRA 6.4.10#64025-sha1:5b8b74079161cd76a20ab66dda52747ee6701bd6.