如何配置原则以忽略迁移生成中的特定表? [重复]

问题描述 投票:0回答:1

我正在使用带有 mysql 缓存适配器和 Doctrine ORM 2.17 的 Symfony 6.4

这会自动创建并填充一个表(默认名称cache_items)。

问题是 Doctrine 不认识到这是一个“特殊”表,因此

symfony console doctrine:migrations:diff

始终添加到

up()

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

还有

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 = \'\' ');

有没有办法告诉条令迁移生成器忽略这个表?

php symfony doctrine-orm doctrine-migrations
1个回答
0
投票

我已经弄清楚了。

必须将其添加到

doctrine.yaml
配置中:

doctrine:
    dbal:
        schema_filter: ~^(?!cache_items)$~
© www.soinside.com 2019 - 2024. All rights reserved.