Doctrine Migrations
  1. Doctrine Migrations
  2. DMIG-11

Comparer always detects changes when using columnDefinition in mapping definitions

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Invalid
    • Labels:
      None

      Description

      The migration diff command always thinks that my model definitions have changed, when I use the manual columnDefinition on a timestamp column:

          dateUpdated:
            type: datetime
            columnDefinition: TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL
      

      This always results in a migration script like this:

      <?php
      
      namespace SuplifyApiMigrations;
      
      use Doctrine\DBAL\Migrations\AbstractMigration,
          Doctrine\DBAL\Schema\Schema;
      
      class Version20101028121948 extends AbstractMigration
      {
          public function up(Schema $schema)
          {
              $this->_addSql('ALTER TABLE ticket CHANGE dateUpdated dateUpdated TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL');
          }
      
          public function down(Schema $schema)
          {
              $this->_addSql('ALTER TABLE ticket CHANGE dateUpdated dateUpdated DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL');
          }
      }
      

      As you can see, the columns look exactly the same. Doctrine just does not seem to parse the manual columnDefinition and compare its result.

        Activity

        Sebastian Hoitz created issue -
        Benjamin Eberlei made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Jonathan H. Wage [ jwage ] Benjamin Eberlei [ beberlei ]
        Resolution Invalid [ 6 ]

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Sebastian Hoitz
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: