Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-510

Schema tool does not recognize existing columns

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.3, 2.4.1
    • Fix Version/s: 2.3.4
    • Component/s: None
    • Security Level: All
    • Labels:
      None
    • Environment:
      Ubuntu 8.04 with PHP 5.3.2 and PostgreSQL 8.4/9.1 (errors on both versions)

      Description

      I'm using doctrine with symfony. The first schema update is working, the table exists with all defined columns.
      When i now run the schema update a second time (without code changes), doctrine tries to create the columns - but they already exists:

      $ php app/console doctrine:schema:update --dump-sql
      CREATE SEQUENCE users_id_seq INCREMENT BY 1 MINVALUE 1 START 1;
      CREATE TABLE users (id INT NOT NULL, email VARCHAR(255) NOT NULL, password VARCHAR(255) DEFAULT NULL, salt VARCHAR(255) DEFAULT NULL, realname VARCHAR(255) NOT NULL, roles TEXT NOT NULL, PRIMARY KEY(id))
      $ php app/console doctrine:schema:update --force
      Updating database schema...
      Database schema updated successfully! "2" queries were executed
      $ php app/console doctrine:schema:update --dump-sql
      ALTER TABLE users ADD id INT NOT NULL;
      ALTER TABLE users ADD email VARCHAR(255) NOT NULL;
      ALTER TABLE users ADD password VARCHAR(255) DEFAULT NULL;
      ALTER TABLE users ADD salt VARCHAR(255) DEFAULT NULL;
      ALTER TABLE users ADD realname VARCHAR(255) NOT NULL;
      ALTER TABLE users ADD roles TEXT NOT NULL;
      ALTER TABLE users ADD PRIMARY KEY (id)

      Doctrine seems to ignore existing columns.

      PHPUnit segfaults because of a backslash prepended to a FQCN and has a failure in the tests run so far (see attached PHPUnit output).

        Activity

        Matthias Lohr created issue -
        Marco Pivetta made changes -
        Field Original Value New Value
        Summary schema update does not recognize existing columns Schema tool does not recognize existing columns
        Environment Ubuntu Linux with PHP 5.3.2 and PostgreSQL 8.4/9.1 (errors on both versions) Ubuntu 8.04 with PHP 5.3.2 and PostgreSQL 8.4/9.1 (errors on both versions)
        Description I'm using doctrine with symfony. The first schema update is working, the table exists with all defined columns.
        When i now run the schema update a second time (without code changes), doctrine tries to create the columns - but they already exists:

        $ php app/console doctrine:schema:update --dump-sql
        CREATE SEQUENCE users_id_seq INCREMENT BY 1 MINVALUE 1 START 1;
        CREATE TABLE users (id INT NOT NULL, email VARCHAR(255) NOT NULL, password VARCHAR(255) DEFAULT NULL, salt VARCHAR(255) DEFAULT NULL, realname VARCHAR(255) NOT NULL, roles TEXT NOT NULL, PRIMARY KEY(id))
        $ php app/console doctrine:schema:update --force
        Updating database schema...
        Database schema updated successfully! "2" queries were executed
        $ php app/console doctrine:schema:update --dump-sql
        ALTER TABLE users ADD id INT NOT NULL;
        ALTER TABLE users ADD email VARCHAR(255) NOT NULL;
        ALTER TABLE users ADD password VARCHAR(255) DEFAULT NULL;
        ALTER TABLE users ADD salt VARCHAR(255) DEFAULT NULL;
        ALTER TABLE users ADD realname VARCHAR(255) NOT NULL;
        ALTER TABLE users ADD roles TEXT NOT NULL;
        ALTER TABLE users ADD PRIMARY KEY (id)

        Doctrine seems to ignore existing columns.
        I'm using doctrine with symfony. The first schema update is working, the table exists with all defined columns.
        When i now run the schema update a second time (without code changes), doctrine tries to create the columns - but they already exists:

        $ php app/console doctrine:schema:update --dump-sql
        CREATE SEQUENCE users_id_seq INCREMENT BY 1 MINVALUE 1 START 1;
        CREATE TABLE users (id INT NOT NULL, email VARCHAR(255) NOT NULL, password VARCHAR(255) DEFAULT NULL, salt VARCHAR(255) DEFAULT NULL, realname VARCHAR(255) NOT NULL, roles TEXT NOT NULL, PRIMARY KEY(id))
        $ php app/console doctrine:schema:update --force
        Updating database schema...
        Database schema updated successfully! "2" queries were executed
        $ php app/console doctrine:schema:update --dump-sql
        ALTER TABLE users ADD id INT NOT NULL;
        ALTER TABLE users ADD email VARCHAR(255) NOT NULL;
        ALTER TABLE users ADD password VARCHAR(255) DEFAULT NULL;
        ALTER TABLE users ADD salt VARCHAR(255) DEFAULT NULL;
        ALTER TABLE users ADD realname VARCHAR(255) NOT NULL;
        ALTER TABLE users ADD roles TEXT NOT NULL;
        ALTER TABLE users ADD PRIMARY KEY (id)

        Doctrine seems to ignore existing columns.

        PHPUnit segfaults because of a backslash prepended to a FQCN and has a failure in the tests run so far (see attached PHPUnit output).
        Benjamin Eberlei made changes -
        Project Doctrine 2 - ORM [ 10032 ] Doctrine DBAL [ 10040 ]
        Key DDC-2110 DBAL-510
        Affects Version/s 2.3 [ 10184 ]
        Affects Version/s 2.3 [ 10185 ]
        Component/s ORM [ 10012 ]
        Benjamin Eberlei made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.3.4 [ 10421 ]
        Resolution Fixed [ 1 ]
        Christian Eikermann made changes -
        Affects Version/s 2.4.1 [ 10527 ]

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Matthias Lohr
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: