views:

800

answers:

4

Hi there!

Can anyone please tell me how can I add a new column of type enum to my schema in order to implement a Doctrine Migration?

Thanks in advance, Best regards!

A: 

Modify your schema and don't build yet the model. run doctrine schema diff then a migration class will be generated for you. Finally you can rebuild your models/forms/filters

ken
+3  A: 
  1. modify your schema

  2. run ./symfony doc:generate-migrations-diff

this will generate one or more files in lib/migrations/doctrine/

  1. run ./symfony doc:migrate

this will apply the generated migrations to the database

  1. run ./symfony doc:build --all-classes

this works for symfony >= 1.3/1.4 and will rebuild all form/filters/model classes according to the modified schema

remember that the migration is generated comparing the new schema.yml to the current model classes, so if you rebuild your classes before running generate-migrations-diff you're screwed.

gpilotino
A: 

Shortcut:

symfony doctrine:build --all-classes --and-migrate