Files
cms_thermo_active/Step.Database/Migrations/Configuration.cs
T
Lucio Maranta 796801f7ee + Added migration
+ Added STATIC data into Database (Roles functions and users)
+ Configuration controller and startupConfig API
* Refactor api names
2018-01-10 17:21:40 +01:00

38 lines
1.5 KiB
C#

namespace Step.Database.Migrations
{
using Step.Database.Controllers;
using Step.Model.DatabaseModels;
using System;
using System.Data.Entity;
using System.Data.Entity.Migrations;
using System.Globalization;
using System.Linq;
public sealed class Configuration : DbMigrationsConfiguration<Step.Database.DatabaseContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = true;
}
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 = 1, Name = "Guest" }
);
context.FunctionsAccess.AddOrUpdate(
new FunctionAccessModel() { FunctionAccessId = 1, Name = "test", Area = "production", Enabled = true, WriteLevelMin = 7, ReadLevelMin = 1 },
new FunctionAccessModel() { FunctionAccessId = 2, Name = "ncData", Area = "production", Enabled = true, WriteLevelMin = 100, ReadLevelMin = 1 },
new FunctionAccessModel() { FunctionAccessId = 3, Name = "functionAccess", Area = "production", Enabled = true, WriteLevelMin = 100, ReadLevelMin = 1 }
);
context.Users.AddOrUpdate
(
UsersController.CreateUserModel("cms", "cms", "cms", "cms", 1, new CultureInfo("en"))
);
}
}
}