Ben
Ben

Reputation: 25807

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

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

Upvotes: 0

Views: 1906

Answers (1)

Bryan M.
Bryan M.

Reputation: 17322

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.

Upvotes: 1

Related Questions