Doctrine Migrations
  1. Doctrine Migrations
  2. DMIG-39

Issue when using serjal columns in PostgreSQL with Doctrine ORM Identity fields

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Environment:
      PostgreSQL and migrations

      Description

      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.

        Activity

        jos de witte created issue -
        Marco Pivetta made changes -
        Field Original Value New Value
        Description 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.

        When using Doctrine ORM mapping fields like this:

        {code}
            /**
             * @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;
        {code}

        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.

        Marco Pivetta made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Benjamin Eberlei [ beberlei ] Marco Pivetta [ ocramius ]
        Resolution Invalid [ 6 ]

          People

          • Assignee:
            Marco Pivetta
            Reporter:
            jos de witte
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: