views:

342

answers:

1

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

+1  A: 

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.

Bryan M.
Thank you very much!
Yosef
No problem. Please remember to mark the question as answered if it solved your problem.
Bryan M.