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

        Hide
        Benjamin Eberlei added a comment -

        Its not possible to fix this issue, its actually a drawback of using "columnDefinition", i started documenting this in the ORM docs.

        Show
        Benjamin Eberlei added a comment - Its not possible to fix this issue, its actually a drawback of using "columnDefinition", i started documenting this in the ORM docs.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: