1
0
mirror of https://github.com/chyzy/RSystem-MVC synced 2024-12-01 17:25:27 +01:00
RSystem-MVC-Fork/RSystem/Migrations/201801011912140_AddMaturaResult.cs

49 lines
1.8 KiB
C#
Raw Normal View History

2018-04-17 11:20:49 +02:00
namespace RSystem.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class AddMaturaResult : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.MaturaResults",
c => new
{
MaturaResultId = c.Int(nullable: false, identity: true),
Points = c.Single(nullable: false),
MaturaSubjectId = c.Int(nullable: false),
RecruitId = c.Int(nullable: false),
})
.PrimaryKey(t => t.MaturaResultId)
.ForeignKey("dbo.MaturaSubjects", t => t.MaturaSubjectId, cascadeDelete: true)
.ForeignKey("dbo.Recruits", t => t.RecruitId, cascadeDelete: true)
.Index(t => t.MaturaSubjectId)
.Index(t => t.RecruitId);
CreateTable(
"dbo.MaturaSubjects",
c => new
{
MaturaSubjectId = c.Int(nullable: false, identity: true),
Name = c.String(),
Description = c.String(),
MaturaType = c.Int(nullable: false),
})
.PrimaryKey(t => t.MaturaSubjectId);
}
public override void Down()
{
DropForeignKey("dbo.MaturaResults", "RecruitId", "dbo.Recruits");
DropForeignKey("dbo.MaturaResults", "MaturaSubjectId", "dbo.MaturaSubjects");
DropIndex("dbo.MaturaResults", new[] { "RecruitId" });
DropIndex("dbo.MaturaResults", new[] { "MaturaSubjectId" });
DropTable("dbo.MaturaSubjects");
DropTable("dbo.MaturaResults");
}
}
}