796801f7ee
+ Added STATIC data into Database (Roles functions and users) + Configuration controller and startupConfig API * Refactor api names
62 lines
2.2 KiB
C#
62 lines
2.2 KiB
C#
namespace Step.Database.Migrations
|
|
{
|
|
using System;
|
|
using System.Data.Entity.Migrations;
|
|
|
|
public partial class InizialCreate : DbMigration
|
|
{
|
|
public override void Up()
|
|
{
|
|
CreateTable(
|
|
"dbo.functions_access",
|
|
c => new
|
|
{
|
|
id = c.Int(nullable: false, identity: true),
|
|
name = c.String(unicode: false),
|
|
write_level_min = c.Int(nullable: false),
|
|
read_level_min = c.Int(nullable: false),
|
|
area = c.String(unicode: false),
|
|
enabled = c.Boolean(nullable: false),
|
|
})
|
|
.PrimaryKey(t => t.id);
|
|
|
|
CreateTable(
|
|
"dbo.roles",
|
|
c => new
|
|
{
|
|
id = c.Int(nullable: false, identity: true),
|
|
name = c.String(unicode: false),
|
|
level = c.Int(nullable: false),
|
|
})
|
|
.PrimaryKey(t => t.id);
|
|
|
|
CreateTable(
|
|
"dbo.users",
|
|
c => new
|
|
{
|
|
id = c.Int(nullable: false, identity: true),
|
|
username = c.String(nullable: false, unicode: false),
|
|
first_name = c.String(unicode: false),
|
|
last_name = c.String(unicode: false),
|
|
password = c.String(unicode: false),
|
|
security_stamp = c.String(unicode: false),
|
|
language = c.String(unicode: false),
|
|
role_id = c.Int(nullable: false),
|
|
})
|
|
.PrimaryKey(t => t.id)
|
|
.ForeignKey("dbo.roles", t => t.role_id, cascadeDelete: true)
|
|
.Index(t => t.role_id);
|
|
|
|
}
|
|
|
|
public override void Down()
|
|
{
|
|
DropForeignKey("dbo.users", "role_id", "dbo.roles");
|
|
DropIndex("dbo.users", new[] { "role_id" });
|
|
DropTable("dbo.users");
|
|
DropTable("dbo.roles");
|
|
DropTable("dbo.functions_access");
|
|
}
|
|
}
|
|
}
|