Skip to content

Instantly share code, notes, and snippets.

@atsvetkov
Last active May 27, 2017 10:52
Show Gist options
  • Save atsvetkov/584ef610fae4de285111d89ba38e20da to your computer and use it in GitHub Desktop.
Save atsvetkov/584ef610fae4de285111d89ba38e20da to your computer and use it in GitHub Desktop.
DbUp console application sample
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