可以运行任务“symfony doctrine build -all”只有一张桌子? [英] Is it possible to run the task "symfony doctrine build --all" on only one table?

查看:111
本文介绍了可以运行任务“symfony doctrine build -all”只有一张桌子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我运行这个完美的任务,它会构建一切并清除数据库:

If I run the folowing task, it builds everything and wipes out the database:

php symfony doctrine build --all

我希望这个任务只对我放在schema.yml中的新表运行

I would like this task to run only for the new table that I've put in schema.yml

可以吗?

推荐答案

我认为你应该使用迁移

首先,您需要恢复初始状态(当模式,模型和数据库同步时)。删除您的更改表单schema.yml重建您的模型 php symfony doctrine:build --all-classes 并导入原始​​数据库。

First, you need to restore the initial state (when schema, model and db are in sync). Remove your changes form schema.yml rebuild your model php symfony doctrine:build --all-classes and import the original database.

之后,在schema.yml中进行更改并运行以下命令:

After that make your changes in schema.yml and run these commands:

php symfony doctrine:generate-migrations-diff
php symfony doctrine:migrate
php symfony doctrine:build --all-classes

这篇关于可以运行任务“symfony doctrine build -all”只有一张桌子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆