This project has moved and is read-only. For the latest updates, please go here.

How am I supposed to use this?

May 1, 2014 at 3:56 PM
Hello,

I am having trouble to get started with this. I have tried the example project and when running DbDeploy.exe, it generates a changelog table in the database and puts all the scripts that needs to be applied to a file called "ProductionUpdate.sql". But DbDeploy, is not executing this file. Do I have to apply this file manually using, "sqlcmd" ? Or is there a way DbDeploy itself can apply it? I see it creating the changelog table. So why not execute the "ProductionUpdate.sql" file too?

How am I supposed to handle the test data? Should that be kept in a different folder and change the DbDeploy scripts directory to this directory while executing? If yes, will that adds an entry into the changelog? It need not add an entry into the changelog as there is no schema change happening. All it is doing is inserting some test data.

Any help would be great!
Coordinator
Aug 25, 2015 at 2:14 AM
I've updated the nuget package, so hopefully it's more transparent.

DbDeploy doesn't actually execute the change script, it just creates it so that it can be reviewed and then executed. Using the MSBuild task, you can make something that DOES execute the script that's generated. See the Database.targets file and the Rebuild target for an example of how that's done.

The changelog table is just there for change tracking by dbdeploy.

The test data should probably just be SQL Scripts. The intent is that you can use this in a testing or development environment to push sample data in. The test data is used primarily by the Database.Targets file, not by dbdeploy directly. DbDeploy doesn't change the database, since you would want to run it against production, and wouldn't want your test data inserted into production.

I've added a text file to the default nuget package with instructions on how to use the command line tool. Look at Database.Targets for more complex examples that could be used on a build server or in a development environment when you want fresh data every time.