Doctrine模式更新要求删除migration_versions表Symfony。

huangapple go评论46阅读模式
英文:

doctrine schema update wants to drop migration_verions table symfony

问题

运行doctrine:schema:update --complete --dump-sql命令时,对于Symfony容器化应用程序,输出如下所示:

ALTER TABLE offer DROP FOREIGN KEY FK_29D6873EC1EA42F3;
DROP TABLE doctrine_migration_versions;

我期望migration_versions表不被删除!
我正在使用mariadb:10.9.4 mysql

英文:

When I try to run doctrine:schema:update --complete --dump-sql on a Symfony dockerized application, the output is showing below:

ALTER TABLE offer DROP FOREIGN KEY FK_29D6873EC1EA42F3;
DROP TABLE doctrine_migration_versions;

I expect that the table migration_versions should not be deleted!
I am using mariadb:10.9.4 mysql

答案1

得分: 3

添加schema_filter到你的doctrine.yaml文件中:

doctrine:
    dbal:
        url: '%env(DATABASE_URL)%'
        schema_filter: "~^(?!doctrine_migration_versions)~"

然后尝试在不使用 --complete 选项的情况下运行命令。

你可以在我之前的一个回答中找到更详细的解释:
https://stackoverflow.com/questions/74991256/symfony-5-doctrine-with-schema-filter-not-working/74992502#74992502

英文:

Updated answer with the comment of @iloo

Add schema_filter to your doctrine.yaml

doctrine:
    dbal:
        url: '%env(DATABASE_URL)%'
        schema_filter: "~^(?!doctrine_migration_versions$)~"

And try to launch the command without the --complete option

You can read better explanation on this on one of my old answer :
https://stackoverflow.com/questions/74991256/symfony-5-doctrine-with-schema-filter-not-working/74992502#74992502

huangapple
  • 本文由 发表于 2023年2月16日 14:15:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/75468487.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定