Symfony - 将列添加到表中,而不会丢失已生成的类 [英] Symfony - Add a column to a table without losing already generated classes

查看:179
本文介绍了Symfony - 将列添加到表中,而不会丢失已生成的类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将列添加到数据库表中,而不覆盖已生成的类? (Doctrine)我要编辑什么文件?

How can I add a column to a Database table without overwriting the classes already generated? (Doctrine) What files do I have to edit?

如果我只是在数据库中添加列,我不能使用Doctrine ORM的set和get函数。

If I simply add the column in the database, I can't use the set and get functions of Doctrine ORM.

推荐答案

使用doctrine迁移。它允许您修改模式,更新数据库和模型,而不会丢失数据库中的现有数据(如果相关)。

Use doctrine migrations. It allows you to modify your schema, update the database and your model without also losing the existing data in your database (in case it is relevant).

http://www.symfony-project.org/doctrine/1_2/en/07-Migrations

适用于symfony 1.4

Applicable for symfony 1.4 too

这篇关于Symfony - 将列添加到表中,而不会丢失已生成的类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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