mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 10:42:08 +00:00
33 lines
699 B
C#
33 lines
699 B
C#
// Get connection string from environment variable
|
|
|
|
using System.Reflection;
|
|
using DbUp;
|
|
|
|
var connectionString = Environment.GetEnvironmentVariable(
|
|
"DB_CONNECTION_STRING"
|
|
);
|
|
|
|
var upgrader = DeployChanges
|
|
.To.SqlDatabase(connectionString)
|
|
.WithScriptsEmbeddedInAssembly(Assembly.GetExecutingAssembly())
|
|
.LogToConsole()
|
|
.Build();
|
|
|
|
var result = upgrader.PerformUpgrade();
|
|
|
|
if (!result.Successful)
|
|
{
|
|
Console.ForegroundColor = ConsoleColor.Red;
|
|
Console.WriteLine(result.Error);
|
|
Console.ResetColor();
|
|
#if DEBUG
|
|
Console.ReadLine();
|
|
#endif
|
|
return -1;
|
|
}
|
|
|
|
Console.ForegroundColor = ConsoleColor.Green;
|
|
Console.WriteLine("Success!");
|
|
Console.ResetColor();
|
|
return 0;
|