views:

248

answers:

2

I've deployed my symfony project to the server and now I wanna change the models inside schema.yml without reseting other unrelated database tables and keep the current data. Is there any diff / upgrade feature for symfony propel project ?

+1  A: 

You can generate the sql by using the 'propel:build-sql' command. The result is a valid SQL file which you can import yourself. In our very big project we just keep track of the SQL itself. We build the models and generate the SQL. Then we copy the new generated SQL to a file containing the SQL for our version. Take care of the SQL where tables are changed instead of created, since you must manually alter that table by yourself.

It cannot be done from Symfony afaik.

TheGrandWazoo
+1  A: 

Take a look at sfPropelSqlDiffPlugin (available from the plugin repository). I've been using it for quite a while and it has worked well for me. It's not perfect (it doesn't deal too well with non-standard stuff like specifying a sqltype in your schema, for example), but it has made life much easier for me.

Instead of trusting the plugin to do the actual execution of the diffed SQL, I prefer to do:

./symfony propel:build-sql-diff

This creates a SQL file in your data dir, which you can then inspect/edit prior to manually executing the script.

Darryl H. Thomas