datenbank nur auf testserver automatisch updaten

This commit is contained in:
hydrant
2020-04-26 14:55:47 +02:00
parent 720b683b06
commit 351530900b

View File

@@ -43,6 +43,9 @@ namespace ReallifeGamemode.Server
[ServerEvent(Event.ResourceStart)] [ServerEvent(Event.ResourceStart)]
public void OnResourceStart() public void OnResourceStart()
{
if (System.Environment.GetEnvironmentVariable("RAGEMP_UPDATE_DATABASE_ON_STARTUP", System.EnvironmentVariableTarget.User) == "true")
{ {
using var dbContext = new DatabaseContext(true); using var dbContext = new DatabaseContext(true);
@@ -73,6 +76,7 @@ namespace ReallifeGamemode.Server
System.Console.WriteLine("Migrations successfull"); System.Console.WriteLine("Migrations successfull");
} }
}
var methods = Assembly.GetExecutingAssembly() var methods = Assembly.GetExecutingAssembly()
.GetTypes() .GetTypes()