Posts Tagged ‘ symfony’

My Laziness and sfPropelMigrationsLightPlugin

By Stanley | Friday, May 2nd, 2008

I have a confession to make: I am lazy. My colleagues know this. One of the things I hate doing when starting on an existing project is setting up the database. Sure, database schema and update scripts should be somewhere in the repository. Chances are good that they are not kept up-to-date with all database changes. Even if they are, I just can’t apply all the update scripts at once because of dependencies or changes have already been applied. 99.9% of the time, I ended up dumping the staging or development database and importing it into mine.

I was going to write a tool that will solve this problem, but my laziness would have none of it. Instead, I searched the Internet and found this cool little tool: sfPropelMigrationsLightPlugin, a Symfony plug-in. It works like this. Whenever there is a database change, you would initialize a migration and the plug-in creates a PHP file for you to add the database changes. To update the database, just run “symfony migrate <app name>” and the tool will automagically apply all missing updates to the database. This feature is particularly useful if there is more than one person working on the project at the same time. Team members just run “symfony migrate <app name>” and viola, their databases are synchronized with yours. No fuss. It couldn’t have been more simple.

Checkout the plugin at http://trac.symfony-project.com/wiki/sfPropelMigrationsLightPlugin.