Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-693

Schema migration issue then column changes.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 2.3
    • Fix Version/s: None
    • Component/s: Schema Managers
    • Security Level: All
    • Labels:
    • Environment:
      ubuntu linux, mysql

      Description

      Migration rise an error then trying ALTER table. Seems like an order problem. Second re-run migration always fix issue. Happens then changes columns in the table.

              /** @noinspection PhpUndefinedMethodInspection */
              $schemaManager = $db->getSchemaManager();
              /** @noinspection PhpUndefinedMethodInspection */
              $fromSchema = $schemaManager->createSchema();
              /** @noinspection PhpUndefinedMethodInspection */
              $sql = $fromSchema->getMigrateToSql($schema, $db->getDatabasePlatform());
              foreach ($sql as $request) {
                  /** @noinspection PhpUndefinedMethodInspection */
                  $db->executeUpdate($request);
              }
      

      Rise error looks like

       An exception occurred while executing 'ALTER TABLE error CHANGE time time TIMESTAMP DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP':
      
      SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mydb.error' doesn't exist
      

        Activity

        Hide
        Benjamin Eberlei added a comment -

        This is not enough information, i need the schema from the database and the local schema that helps me to reproduce this error. With this information i cannot reproduce this. Please provide feedback.

        Show
        Benjamin Eberlei added a comment - This is not enough information, i need the schema from the database and the local schema that helps me to reproduce this error. With this information i cannot reproduce this. Please provide feedback.
        Hide
        Maksim Muruev added a comment -

        I've found there problem is. Seems like SchemaManager unable undertand '<db_name>.<table_name> format as table name for createTable() method. After use just table name issue disappears.

        Show
        Maksim Muruev added a comment - I've found there problem is. Seems like SchemaManager unable undertand '<db_name>.<table_name> format as table name for createTable() method. After use just table name issue disappears.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: