outsourced database initialization, faction bank accounts get added if none exist
This commit is contained in:
22
Server/Util/DatabaseHelper.cs
Normal file
22
Server/Util/DatabaseHelper.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using GTANetworkAPI;
|
||||
using reallife_gamemode.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace reallife_gamemode.Server.Util
|
||||
{
|
||||
class DatabaseHelper
|
||||
{
|
||||
public static void InitDatabaseFirstTime()
|
||||
{
|
||||
NAPI.Util.ConsoleOutput("Initializing database...");
|
||||
using(var dbContext = new DatabaseContext())
|
||||
{
|
||||
dbContext.Users.First();
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user