如何用我的修改来更新我的symfony模块?

时间:2022-06-12 02:26:37

I have a very big problem with symfony module generation as i always make modification in my database (add tables , add columns, changes names, changes columns data-type .....) and i want a good way to build the symfony module without any effect on the modules that i didn't change it and without drop the data in the database... on brief i need to update my symfony module with my changes ONLY.

symfony模块代我有一个非常大的问题,我总是让我的数据库中修改(添加表,添加列,改变名称,修改列数据类型.....)和我想要一个很好的方式来构建symfony模块的模块没有任何影响我没有改变它,没有把数据库中的数据……简单地说,我只需要用我的更改更新symfony模块。

1 个解决方案

#1


3  

I think you mean "models" instead of "modules" here.

我想你是说“模型”而不是“模块”。

If this is the case, basically once you've got data in the database that you don't want to drop:

如果是这样的话,一旦你在数据库中有了不想删除的数据,

1 - Make any needed changes to your schema.yml

1 -对你的方案做任何需要的修改

2 - Use MySQL ALTER TABLE etc to make changes directly to your database

2 -使用MySQL ALTER TABLE等直接对数据库进行修改

3 - Use the following commands to regenerate your models:

3 -使用以下命令重新生成您的模型:

symfony doctrine:build --model
symfony doctrine:build --sql
symfony doctrine:build --forms
symfony doctrine:clean-model-files // to clean up old stuff

Assuming you haven't made changes to your base classes (which you shouldn't do), the rebuilding of the models shouldn't break anything. You're basically re-building everything but only the changes you introduced in your schema will be introduced.

假设您没有对基类进行更改(这是不应该做的),那么模型的重新构建不应该破坏任何东西。您基本上是在重新构建所有的东西,但是只会引入您在模式中引入的更改。

#1


3  

I think you mean "models" instead of "modules" here.

我想你是说“模型”而不是“模块”。

If this is the case, basically once you've got data in the database that you don't want to drop:

如果是这样的话,一旦你在数据库中有了不想删除的数据,

1 - Make any needed changes to your schema.yml

1 -对你的方案做任何需要的修改

2 - Use MySQL ALTER TABLE etc to make changes directly to your database

2 -使用MySQL ALTER TABLE等直接对数据库进行修改

3 - Use the following commands to regenerate your models:

3 -使用以下命令重新生成您的模型:

symfony doctrine:build --model
symfony doctrine:build --sql
symfony doctrine:build --forms
symfony doctrine:clean-model-files // to clean up old stuff

Assuming you haven't made changes to your base classes (which you shouldn't do), the rebuilding of the models shouldn't break anything. You're basically re-building everything but only the changes you introduced in your schema will be introduced.

假设您没有对基类进行更改(这是不应该做的),那么模型的重新构建不应该破坏任何东西。您基本上是在重新构建所有的东西,但是只会引入您在模式中引入的更改。