How to configure doctrine to ignore specific table in migration generation?

82 views Asked by At

I am using Symfony 6.4 with mysql cache adapter and Doctrine ORM 2.17

This automatically creates and populates a table (default name cache_items).

The issue is that Doctrine does not recognize this is a "special" table and thus

symfony console doctrine:migrations:diff

Always adds to the up()

$this->addSql('DROP TABLE cache_items');

and also to the down()

$this->addSql('CREATE TABLE cache_items (item_id VARBINARY(255) NOT NULL, item_data MEDIUMBLOB NOT NULL, item_lifetime INT UNSIGNED DEFAULT NULL, item_time INT UNSIGNED NOT NULL, PRIMARY KEY(item_id)) DEFAULT CHARACTER SET utf8mb3 COLLATE `utf8mb3_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');

Is there a way to tell doctrine migration generator to ignore this table?

1

There are 1 answers

0
michnovka On BEST ANSWER

I have figured it out.

Had to add this to doctrine.yaml config:

doctrine:
    dbal:
        schema_filter: ~^(?!cache_items)$~