Sermanes
Sermanes

Reputation: 506

How can I modify doctrine:migrations:diff?

I want modify doctrine:migrations:diff command, because when I run it, the generating code is bad, so I want edit the config file but I dont know where is it.

Example bad code:

    public function up(Schema $schema)
    {
        // this up() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('DROP TABLE sessions');
        //More sql
    }

and a lot of more sql sentences, which are not modify, and appear.

Upvotes: 3

Views: 706

Answers (1)

Picoss
Picoss

Reputation: 2057

You can configure doctrine/dbal to ignore the sessions table (propably because you use PdoSessionHandler to store sessions in your database).

Add the following lines in your config.yml:

doctrine:
  dbal:
    schema_filter: ~^(?!sessions)~
    .....

Take a look a the DoctrineMigrationBundle documentation on symfony website

Upvotes: 4

Related Questions