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.

        Hide
        Marco Pivetta added a comment -

        This is a DBAL problem.

        Please verify this with the DBAL diff tools (latest master) only and eventually report a DBAL issue without involving migrations.

        Show
        Marco Pivetta added a comment - This is a DBAL problem. Please verify this with the DBAL diff tools (latest master) only and eventually report a DBAL issue without involving migrations.
        Marco Pivetta made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Benjamin Eberlei [ beberlei ] Marco Pivetta [ ocramius ]
        Resolution Invalid [ 6 ]

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DMIG-39, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

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

            Dates

            • Created:
              Updated:
              Resolved: