Skip to content

Loading…

DBAL-903: php app/console doctrine:migration:diff generates redundant sql queries for postgres #2146

Closed
doctrinebot opened this Issue · 6 comments

3 participants

@doctrinebot

Jira issue originally created by user hanovruslan:

php app/console doctrine:migration:diff

generates redundant sql queries for postgres

symfony 2.4.2,
postgres 9.3
doctrine/orm: ~2.2,>=2.2.3
doctrine/doctrine-bundle: 1.2.*
doctrine/migrations: dev-master
doctrine/doctrine-migrations-bundle: dev-master

    public function up(Schema $schema)
    {

        $this->abortIf($this->connection->getDatabasePlatform()->getName() != "postgresql", "Migration can only be executed safely on 'postgresql'.");

        $this->addSql("DROP SEQUENCE acl*classes_id*seq1 CASCADE");
        $this->addSql("DROP SEQUENCE acl*security_identities_id*seq1 CASCADE");
        $this->addSql("DROP SEQUENCE acl*object_identities_id*seq1 CASCADE");
        $this->addSql("DROP SEQUENCE acl*entries_id*seq1 CASCADE");
    }

    public function down(Schema $schema)
    {

        $this->abortIf($this->connection->getDatabasePlatform()->getName() != "postgresql", "Migration can only be executed safely on 'postgresql'.");

        $this->addSql("CREATE SEQUENCE acl*classes_id*seq INCREMENT BY 1 MINVALUE 1 START 1");
        $this->addSql("CREATE SEQUENCE acl*security_identities_id*seq INCREMENT BY 1 MINVALUE 1 START 1");
        $this->addSql("CREATE SEQUENCE acl*object_identities_id*seq INCREMENT BY 1 MINVALUE 1 START 1");
        $this->addSql("CREATE SEQUENCE acl*entries_id*seq INCREMENT BY 1 MINVALUE 1 START 1");
        $this->addSql("CREATE SEQUENCE acl*classes_id*seq1 INCREMENT BY 1 MINVALUE 1 START 1");
        $this->addSql("CREATE SEQUENCE acl*security_identities_id*seq1 INCREMENT BY 1 MINVALUE 1 START 1");
        $this->addSql("CREATE SEQUENCE acl*object_identities_id*seq1 INCREMENT BY 1 MINVALUE 1 START 1");
        $this->addSql("CREATE SEQUENCE acl*entries_id*seq1 INCREMENT BY 1 MINVALUE 1 START 1");
    }
@doctrinebot

Comment created by @deeky666:

Doctrine ORM 2.2.x is EOL and won't receive any updates anymore. Please consider upgrading to at least 2.3 and reopen if the issue is still there. There have been a LOT of fixes to platforms' SQL generation since 2.2.x.
Also if you still encounter the issue, please add your mapping information, otherwise it will be hard to rack the issue down.

@doctrinebot

Comment created by @deeky666:

Oh sorry read your ORM version constraint wrong. Reopening. Please can you give the exact DBAL version you are using and mapping information? Thanks.

@doctrinebot

Comment created by charlie_wasp:

Vote for this issue.

postgres: 9.3,
doctrine/orm: "2.2,>=2.2.3",
doctrine/doctrine-bundle: "
1.3",
doctrine/migrations": "1.0.x-dev",
doctrine/doctrine-migrations-bundle": "2.1.x-dev"

@doctrinebot doctrinebot added the Bug label
@deeky666 deeky666 was assigned by doctrinebot
@deeky666
Doctrine member

Cannot reproduce, not enough information given. Closing for now. If this still is an issue, please report how to reproduce and I'll reopen.

@deeky666 deeky666 closed this
@seyfer

Have same issue now with Postgre

DROP SEQUENCE

generates every time. I don't know why.

@deeky666
Doctrine member

@seyfer we need to be able to reproduce this otherwise we can't do anything about it. Please try to track down the issue to DBAL code as we are not the maintainers of migrations here. Maybe providing the mapping information that cause the issue could help for now if you are not able to track the issue down to DBAL.

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.