propelorm/Propel — Issue #251: Instructions for "diff" on the site
Author: pmarking
Created: 2012-01-06 13:44:54+00:00
State: open

If I needed to make a change to the database, for example add a column
to a table, the current documentation says to do the following:

1. Modify the database schema in the schema.xml file.
2. Run 'propel-gen diff' to generate the migration file/class.
3. Edit the migration file/class, if necessary.
4. Run 'propel-gen migrate' to apply the changes to the database.

However, if I *only* do those steps, my object model will be out of
sync with the schema and will still have no knowledge of the new
column (this would be even worse if I wanted to *remove* a column from
the schema, in which case queries still using that old column would
actually fail and bring my site to a halt).

That said, I'm pretty sure that the "missing 5th step" should be:

(5) Run 'propel-gen om' to generate the updated object model classes.

(Note: I specified 'propel-gen om' and not the "triple-action" command
of just 'propel-gen' without any parameters, because we specifically
do *not* want to regenerate the sql file, and we also have no need to
reconvert the runtime configuration file since that wouldn't have
changed.)