Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1657

The Doctrine cli tool does not handle schema correctly.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.2
    • Fix Version/s: 2.3
    • Component/s: Tools
    • Security Level: All
    • Labels:
      None
    • Environment:
      Linux Mint Debian Edition, PHP 5.3.10, PostgreSQL 9.1

      Description

      At first time, sorry for my english and I will be short and brief, the problem is clearly explained in the title and the test is very simple.

      The entity

      /**
       * Short description.
       *
       * @Entity(repositoryClass="Stonewood\Model\Entity\Repository\Screen")
       * @Table(name="stonewood.screen")
       */
      class Screen extends Entity
      {
      
          /**
           * Identifier
           * @var integer
           *
           * @Id
           * @GeneratedValue(strategy="IDENTITY")
           * @Column(name="pk", type="integer", nullable=false)
           */
          private $pk;
      
          /**
           * Title
           * @var string
           *
           * @Column(name="title", type="string", length=255, nullable=false)
           */
          private $title;
      
          /**
           * Path
           * @var string
           *
           * @Column(name="path", type="string", length=255, nullable=false)
           */
          private $path;
      
          /**
           * Register date
           * @var Date
           *
           * @Column(name="ddate", type="date", nullable=false)
           */
          private $ddate;
      
          /**
           * Avatar
           * @var Stonewood\Model\Entity\Avatar
           *
           * @ManyToOne(targetEntity="Stonewood\Model\Entity\Avatar")
           * @JoinColumn(name="pk_avatar", referencedColumnName="pk", nullable=true, onDelete="CASCADE")
           */
          private $avatar;
      
          /**
           *
           */
          public function __construct($pk = null, $title = null, $path = null, $ddate = null, $avatar = null) {
              $this->setPk($pk);
              $this->setTitle($title);
              $this->setPath($path);
              $this->setDdate($ddate);
              $this->setAvatar($avatar);
          }
      
          [...]
      
      }
      

      Before the first deployment

      ./doctrine orm:schema-tool:update --dump-sql
      CREATE TABLE stonewood.screen (pk SERIAL NOT NULL, pk_avatar INT DEFAULT NULL, title VARCHAR(255) NOT NULL, path VARCHAR(255) NOT NULL, ddate DATE NOT NULL, PRIMARY KEY(pk));
      CREATE INDEX IDX_D91A7FB3E9032144 ON stonewood.screen (pk_avatar);
      

      During the first deployement

       
      ./doctrine orm:schema-tool:update --force
      Updating database schema...
      Database schema updated successfully! "100" queries were executed
      

      I test the application and all work correctly

      After this test

       
      ./doctrine orm:schema-tool:update --dump-sql
      ALTER TABLE screen ADD pk SERIAL NOT NULL;
      ALTER TABLE screen ADD pk_avatar INT DEFAULT NULL;
      ALTER TABLE screen ADD title VARCHAR(255) NOT NULL;
      ALTER TABLE screen ADD path VARCHAR(255) NOT NULL;
      ALTER TABLE screen ADD ddate DATE NOT NULL;
      ALTER TABLE screen ADD CONSTRAINT FK_D91A7FB3E9032144 FOREIGN KEY (pk_avatar) REFERENCES stonewood.avatar (pk) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE;
      CREATE INDEX IDX_D91A7FB3E9032144 ON screen (pk_avatar);
      ALTER TABLE screen ADD PRIMARY KEY (pk);
      

      The result is false. I should see Nothing to update - your database is already in sync with the current entity metadata.
      In addition, the schema name does not appear, except for foreign key, what must be causing the problem.

        Activity

        Presteus created issue -
        Hide
        Benjamin Eberlei added a comment -

        This issue was partially fixed in DBAL already, however it seems there is still a problem with sequence detection.

        Show
        Benjamin Eberlei added a comment - This issue was partially fixed in DBAL already, however it seems there is still a problem with sequence detection.
        Benjamin Eberlei made changes -
        Field Original Value New Value
        Workflow jira [ 13460 ] jira-feedback [ 14023 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback [ 14023 ] jira-feedback2 [ 15887 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 15887 ] jira-feedback3 [ 18143 ]
        Hide
        Benjamin Eberlei added a comment -

        Fixed the sequence problem in 2.3, the other schema problems where indeed fixed in 2.2.1 already.

        Show
        Benjamin Eberlei added a comment - Fixed the sequence problem in 2.3, the other schema problems where indeed fixed in 2.2.1 already.
        Benjamin Eberlei made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.3 [ 10185 ]
        Resolution Fixed [ 1 ]

        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=DDC-1657, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Presteus
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: