Uploaded image for project: 'Doctrine DBAL'
  1. Doctrine DBAL
  2. DBAL-493

Schema\Comparator incorrect diff with sqlite and unsigned integer


    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Can't Fix
    • Affects Version/s: 2.4
    • Fix Version/s: None
    • Component/s: Schema Managers
    • Security Level: All
    • Labels:
    • Environment:
      php 5.3.10-1ubuntu3.6
      SQLite Library => 3.7.9


      Using the Schema\Comparator to diff a table in sqlite with a unsigned integer. When creating the table and comparing it with the same definition it gives a diff which is not expected:

      Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
      $schema = new \Doctrine\DBAL\Schema\Schema();
      $usersTable = $schema->createTable("test_users");
      $usersTable->addColumn("id", "integer", array("unsigned" => true, 'autoincrement' => true));
      $usersTable->addColumn("username", "string", array("length" => 32));
      $usersTable->addIndex( array( 'username' ) );
      $usersTable->addColumn("password", "string", array("length" => 64));
      $platform = new \Doctrine\DBAL\Platforms\SqlitePlatform();
      $queries = $platform->getCreateTableSQL($usersTable);
      foreach($queries as $query) {
      $tableDetail = $sm->listTableDetails($usersTable->getName());
      $comparator = new \Doctrine\DBAL\Schema\Comparator();
      $diff = $comparator->diffTable($tableDetail, $usersTable);
      if ($diff) {
      } else {
          print("no diff");

      Expect result:

      no diff

      Actual result:

      DROP INDEX IDX_1F5D03E2F85E0677
      CREATE TEMPORARY TABLE __temp__test_users AS SELECT id, username, password FROM test_users
      DROP TABLE test_users
      CREATE TABLE test_users (id INTEGER NOT NULL, username VARCHAR(32) NOT NULL, password VARCHAR(64) NOT NULL, PRIMARY KEY(id))
      INSERT INTO test_users (id, username, password) SELECT id, username, password FROM __temp__test_users
      DROP TABLE __temp__test_users
      CREATE INDEX IDX_1F5D03E2F85E0677 ON test_users (username)

      When setting unsigned to false everything works. Shouldn't Doctrine know unsigned is not supported in sqlite?


        richardhinkamp Richard Hinkamp created issue -
        beberlei Benjamin Eberlei made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Can't Fix [ 7 ]


          • Assignee:
            beberlei Benjamin Eberlei
            richardhinkamp Richard Hinkamp
          • Votes:
            0 Vote for this issue
            2 Start watching this issue


            • Created: