IW4M-Admin/SharedLibrary/Migrations/Configuration.cs

53 lines
1.5 KiB
C#
Raw Normal View History

2018-03-06 02:22:19 -05:00
namespace SharedLibrary.Migrations
{
using System;
using System.Data.Entity;
using System.Data.Entity.Migrations;
using System.Linq;
internal sealed class Configuration : DbMigrationsConfiguration<SharedLibrary.Database.DatabaseContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = true;
AutomaticMigrationDataLossAllowed = true;
}
protected override void Seed(SharedLibrary.Database.DatabaseContext context)
{
context.AliasLinks.AddOrUpdate(new SharedLibrary.Database.Models.EFAliasLink()
{
AliasLinkId = 1
});
var currentAlias = new SharedLibrary.Database.Models.EFAlias()
{
AliasId = 1,
Active = true,
DateAdded = DateTime.UtcNow,
IPAddress = 0,
Name = "IW4MAdmin",
LinkId = 1
};
context.Aliases.AddOrUpdate(currentAlias);
context.Clients.AddOrUpdate(new SharedLibrary.Database.Models.EFClient()
{
ClientId = 1,
Active = false,
Connections = 0,
FirstConnection = DateTime.UtcNow,
LastConnection = DateTime.UtcNow,
Level = Objects.Player.Permission.Console,
Masked = true,
NetworkId = 0,
AliasLinkId = 1,
CurrentAliasId = 1,
});
base.Seed(context);
}
}
}