This project has moved. For the latest updates, please go here.
The easiest way to get started with DbDeploy is to simply download the NuGet package from http://nuget.org/packages/DbDeployNet2/

It'll set up the appropriate structures, add a database.targets file and be usable right out of the gate, assuming you have a default instance of Sql Server installed. Give it a try!

Please note that DbDeploy is a differencing engine. By default, it does NOT make changes to your database, other than adding the ChangeLog table, which it uses for change tracking. Remember
this is designed to be run against development, staging and production servers. We think that automatically updating your database in production is a risky thing, so you're expected to review
the scripts that are generated by DbDeploy first, before updating a production environment.

DbDeploy generates an output file that can be run against a database to bring it up to the current version.

Assuming you're using Sql Server, the following steps will demonstrate how to use DbDeploy in your environment:

1. Install the Nuget package into an empty Assembly (dll) project.
2. On the local machine, create a new database called DbDeploySample. Make sure that you have full access to it.
3. Once installed, you'll have a Scripts directory created for you. In this scripts directory is a folder called Deployed Scripts. This is where all of your scripts for modifying your database will go.
4. Add a script to the Deployed Scripts folder. Doesn't have to be amazing, just something that will execute some SQL against the database. There should already be a "1" script in the folder, so you'll want to use a different number. Scripts are applied in numerical order. Scripts are only applied to a database one time, so once a script is deployed, you shouldn't edit it further.
5. Make sure you save everything and then run the following from the command line IN THE PROJECT'S ROOT FOLDER: .\dbdeploy\DatabaseDeploy.exe
6. After the run is complete, you'll have a new file in the project folder called DbDeploySampleOutput.sql.
7. Open the DbDeploySampleOutput.sql file in Sql Server Management Studio, and when connected to the DbDeploySample database, run the script.

That's all it takes to run against a server and update that server! Plus, all changes will be source control managed.

There are command line arguments that you can use to adjust behavior and these arguments are listed below. You can also modify the DatabaseDeploy.exe.config file to update the settings that are used by DatabaseDeploy.

There are many more complex things that you can do with DbDeploy, like using the MSBuild task. In the dbdeploy folder is a sample Database.targets file. The Rebuild target contains all of the logic
to delete the database and recreate it from scratch or create it if it doesn't exist, but this is not a function of DbDeploy, rather DbDeploy is called as part of that overall process.

All of the settings for the database.targets file are in the top variables. You'll need to adjust them to fit your environment. The Rebuild.bat shows how you can use MSBuild to call the rebuild target.

We hope you find DbDeploy useful in your application.

Full command line help information
_
DatabaseDeploy 1.0.5714.30882
Copyright (c) DatabaseDeploy 2015. This code is licensed under the Microsoft Pu
blic License (MS-PL). http://www.opensource.org/licenses/MS-PL.

-g, --ChangeLog The name of the ChangeLog table.

-c, --ConnectionString The connection string that will be used to
connect to the database to evaluate
dbdeploy scripts.

-d, --DatabaseManagementSystem The database to use. (mssql, mysql, ora)

-p, --DatabaseScriptPath The path where database scripts can be
found.

-a, --FileNamePattern The pattern that should be used to parse
the script file names.

-n, --LastChangeToApply The number of the last script to apply to
the database. Defaults to 0, or all
available scripts.

-f, --OutputFile The name of the file that will be created
for the updates that need to be run.
Defaults to DbDeploy

-r, --Recursive Whether or not the path should be crawled
recursively looking for database scripts.

-o, --RootDirectory The path where dbdeploy should start
running.

-s, --Schema The schema to use for scripts.

-l, --ScriptListFile The file that will contain a list of all of
the scripts found.

-w, --SearchPattern The wildcard pattern that should be used to
match for scripts.

-u, --UndoOutputFile The file that will contain undo scripts.

--help Display this help screen.

--version Display version information.

Last edited Aug 25, 2015 at 2:24 AM by rakker91, version 3

Comments

rakker91 Aug 25, 2015 at 2:24 AM 
I've added better step by step documentation in a text document in the source.