Skip to content

Commit

Permalink
Merge branch 'master' of github.com:bradyholt/dbup-sqlserver-scripting
Browse files Browse the repository at this point in the history
  • Loading branch information
bradymholt committed Apr 13, 2015
2 parents 6c9df63 + e5505fb commit 758f07b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# DbUp SQL Server Object Scripting
SQL Server object definition scripting for [DbUp](http://dbup.github.io/). Extends DbUp to provide SQL Server object definition scripting when running migrations from Visual Studio Package Manager Console. When a database object changes during a migration, its latest definition will be saved in the project. This allows you to have all of your database object definitions versioned in your repository and to easily compare the before/after diff of a definition changed by a migration (great for pull request / code reviews!).

## Demo

[![Demo Video](http://img.youtube.com/vi/2uMsVl_Zk6Y/0.jpg)](https://www.youtube.com/watch?v=2uMsVl_Zk6Y)

## Install
Install-Package dbup-sqlserver-scripting

Expand All @@ -10,21 +14,21 @@ SQL Server object definition scripting for [DbUp](http://dbup.github.io/). Exte
2. Rather than calling `.PerformUpgrade` on the UpgradeEngine, you need to instantiate a ScriptingUpgrader object and call `Run` on it instead.

For example:

<pre>
static int Main(string[] args)
{
var connectionString = "Server=(localdb)\\v11.0;Integrated Security=true;AttachDbFileName=C:\\Users\\johndoe\\DbUpTest.mdf;";
var upgrader =
DeployChanges.To
.SqlDatabase(connectionString)
<strong>.SqlDatabase(connectionString)</strong>
.WithScriptsEmbeddedInAssembly(Assembly.GetExecutingAssembly())
.LogToConsole()
.Build();

//var result = upgrader.PerformUpgrade(); //Don't do this! Do the following instead.

ScriptingUpgrader upgradeScriptingEngine = new ScriptingUpgrader(upgrader);
var result = upgradeScriptingEngine.Run(args);
<strong>ScriptingUpgrader upgradeScriptingEngine = new ScriptingUpgrader(upgrader);</strong>
<strong>var result = upgradeScriptingEngine.Run(args);</strong>

if (!result.Successful)
{
Expand All @@ -39,7 +43,7 @@ For example:
Console.ResetColor();
return 0;
}

</pre>
## Usage
This package depends on [dbup-consolescripts](https://github.com/bradyholt/dbup-consolescripts) to provide Package Manager Console usage.

Expand Down

0 comments on commit 758f07b

Please sign in to comment.