我正在使用带有 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 = \'\' ');
有没有办法告诉条令迁移生成器忽略这个表?
我已经弄清楚了。
必须将其添加到
doctrine.yaml
配置中:
doctrine:
dbal:
schema_filter: ~^(?!cache_items)$~