namespace Step.Database.Migrations { using Step.Model.DatabaseModels; using System.Data.Entity.Migrations; using static Step.Utils.Constants; public sealed class Configuration : DbMigrationsConfiguration { public Configuration() { AutomaticMigrationsEnabled = true; AutomaticMigrationDataLossAllowed = true; ContextKey = "Step.Database.DatabaseContext"; } protected override void Seed(DatabaseContext context) { // This method will be called after migrating to the latest version. context.Roles.AddOrUpdate( new RoleModel() { RoleId = 1, Level = 10, Name = "Admin" }, new RoleModel() { RoleId = 2, Level = 0, Name = "Guest" } ); context.FunctionsAccess.AddOrUpdate( // General Function new FunctionAccessModel() { FunctionAccessId = 1, Name = "functionAccess", Area = AREAS.GENERAL_KEY, Enabled = true, WriteLevelMin = 100, ReadLevelMin = 1, PlcId = -1 }, new FunctionAccessModel() { FunctionAccessId = 2, Name = "logout", Area = AREAS.GENERAL_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = -1 }, new FunctionAccessModel() { FunctionAccessId = 3, Name = "userData", Area = AREAS.GENERAL_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = -1 }, new FunctionAccessModel() { FunctionAccessId = 4, Name = "ncData", Area = AREAS.GENERAL_KEY, Enabled = true, WriteLevelMin = 10, ReadLevelMin = 1, PlcId = -1 }, new FunctionAccessModel() { FunctionAccessId = 5, Name = "startupIcons", Area = AREAS.GENERAL_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 0 }, new FunctionAccessModel() { FunctionAccessId = 6, Name = "alarmCmd", Area = AREAS.GENERAL_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 1 } ); context.SaveChanges(); } } }