Last active
May 27, 2017 10:52
-
-
Save atsvetkov/584ef610fae4de285111d89ba38e20da to your computer and use it in GitHub Desktop.
DbUp console application sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(string[] args) | |
{ | |
var connectionString = ConfigurationManager.ConnectionStrings["Database"].ConnectionString; | |
// creates the database if not yet exists | |
EnsureDatabase.For.SqlDatabase(connectionString); | |
var upgrader = DeployChanges.To.SqlDatabase(connectionString) | |
.WithScriptsEmbeddedInAssembly(Assembly.GetExecutingAssembly()) | |
.LogToConsole() | |
.Build(); | |
var result = upgrader.PerformUpgrade(); | |
Console.Out.WriteLine(result.Successful ? "Success" : "Failure"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment