views:

34

answers:

3

I run my build script and then I have to remember which of the database SQL and PL/SQL scripts to run each time I deploy my application. How can I include these patches in my build script? Or does everybody just run them manually? Currently I number my patches so I know the order to run them, but sometimes I have to check SVN history to know what number to start at.

I'm using PHP but can use Java in my solution to this problem.

+1  A: 

liquibase might solve this problem for you which integrates into ant or maven but can be started from cmd line too

Karussell
+1  A: 

You should be saving your changes as scripts and putting them in source control like the rest of your code. Then you know what changes belong to what build and need to be promoted to prod.

HLGEM
+1. I do next: `trunk/Database/Patches/0.9.2 to 0.9.3/x_table.sql`
abatishchev
@HLGEM I am putting the scripts in source control but I have not found a satisfying way to keep track of which ones have run and which have not. I suppose putting them in app-version folder names like abatischev suggests is an option, but still has a manual component to it.
RenderIn
A: 

Since you're using PHP phing/DbDeployTask would be a smart choice. For every DB table you will have a start file and a number of patches, e.g.:

001 user.sql
002 project.sql
501 user-AddColumnAvatar.sql

etc.

Vincenzo