Skip to content

Loading…

DBAL-693: Schema migration issue then column changes. #1915

Closed
doctrinebot opened this Issue · 3 comments

2 participants

@doctrinebot

Jira issue originally created by user maksim.muruev@gmail.com:

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
@doctrinebot

Comment created by @beberlei:

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.

@doctrinebot

Comment created by maksim.muruev@gmail.com:

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

@doctrinebot

Issue was closed with resolution "Invalid"

@doctrinebot doctrinebot added the Bug label
@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.