Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2843

SchemaTool update SQL always contains queries to set default value on columns, even if they haven't changed.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.3
    • Fix Version/s: 2.5, 2.4.2
    • Component/s: None
    • Labels:

      Description

      For example, I've got this schema:

      Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
      use Doctrine\ORM\Mapping as ORM;
      
      /**
       * @ORM\Table(name="tbl_company")
       * @ORM\Entity
       */
      class Company
      {
          /**
           * @ORM\Column(name="verified", type="boolean", nullable=false, options={"default"=false})
           */
          protected $verified = false;
      }
      

      I introduce column "verified", which is not nullable and this way I want all old entries to automatically update - it works. Then, I'm working and doing another updates. In every update SQL there is ALTER query, though default value haven't been changed since I had created it.

      ALTER TABLE tbl_company ALTER verified SET  DEFAULT 'false';

      Shouldn't it check for changes and apply this query only if default value is changed? When I'm creating migrations, there are about ~60 queries which doesn't change anything and ex. 1 which does - it's very distracting.

        Activity

        Hide
        Benjamin Eberlei added a comment -

        This is an issue in DBAL. This should be reproduced using the \Doctrine\DBAL\Schema\Table API and then fixedn on DBAL.

        Show
        Benjamin Eberlei added a comment - This is an issue in DBAL. This should be reproduced using the \Doctrine\DBAL\Schema\Table API and then fixedn on DBAL.

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Kamil Kokot
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: