英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论