Files
cms_thermo_active/Step.Database/Migrations/Configuration.cs
T
Lucio Maranta 0f15f2e367 Added OriginPosition
Fixed fanuc TT
& Minorfixes
2018-11-30 13:26:46 +01:00

49 lines
3.1 KiB
C#

namespace Step.Database.Migrations
{
using Step.Model.DatabaseModels;
using System.Data.Entity.Migrations;
using static Step.Model.Constants.FUNCTIONALITY_NAMES;
using static Step.Model.Constants.AREAS;
using static Step.Model.Constants;
public sealed class Configuration : DbMigrationsConfiguration<DatabaseContext>
{
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 = (int)ROLE_IDS.CMS_SERVICE_ONLY, Level = 100, Name = "cmsServiceOnly" },
new RoleModel() { RoleId = (int)ROLE_IDS.ADMIN, Level = 10, Name = "Admin" },
new RoleModel() { RoleId = (int)ROLE_IDS.GUEST, Level = 1, Name = "Guest" }
);
context.FunctionsAccess.AddOrUpdate(
// General Function, if plcId is 0 then the functionality is not connected to the NC
new FunctionAccessModel() { Name = GENERAL, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 100, ReadLevelMin = 1, PlcId = 0},
new FunctionAccessModel() { Name = USER_FUNCTIONS, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 0},
new FunctionAccessModel() { Name = NC_DATA, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 10, ReadLevelMin = 1, PlcId = 0},
new FunctionAccessModel() { Name = ALARM_CMD, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 1},
new FunctionAccessModel() { Name = STARTUP_ICONS, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 2},
// Under hood
new FunctionAccessModel() { Name = PROCESS_CMD, Area = UNDER_HOOD, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 3},
new FunctionAccessModel() { Name = NC_SOFTKEY, Area = UNDER_HOOD, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 4},
new FunctionAccessModel() { Name = USER_SOFTKEY, Area = UNDER_HOOD, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 5},
new FunctionAccessModel() { Name = HEADS_CMD, Area = UNDER_HOOD, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 6},
new FunctionAccessModel() { Name = AXES_SELECTION, Area = UNDER_HOOD, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 7},
new FunctionAccessModel() { Name = TOOL_MANAGER, Area = TOOLING_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 8},
new FunctionAccessModel() { Name = MAINTENANCE, Area = MAINTENANCE_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 9}
);
context.SaveChanges();
}
}
}