开发者

Doctrine (on Ubuntu): What command generate models from database without delete existing models?(I add new tables soo i want update models)

开发者 https://www.devze.com 2022-12-31 02:02 出处:网络
Doctrine (on Ubu开发者_StackOverflow社区ntu): What command generate models from database without delete existing models?(I add new tables soo i want update models)

Doctrine (on Ubu开发者_StackOverflow社区ntu): What command generate models from database without delete existing models?(I add new tables soo i want update models) Thanks


If you're using Doctrine 1, you'll need to make use of Migrations. Migrations can either be written manually, or auto-generated one of a few different commands:

./doctrine generate-migration
./doctrine generate-migrations-db
./doctrine generate-migrations-models

Migrations can be a fairly complex topic, so I would read up on the documentation. You may also want to check out this slide show.

If you're using Doctrine 2, things get a little simpler. It doesn't have a Migrations class (yet), but there an easy-to-use command to non-destructively update your db schema:

./doctrine orm:schema-tool:update

This has worked well for me, but can sometimes fail due to complex foreign key constraints.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号