Added some initiating data for working further in this projekt
This commit is contained in:
@ -0,0 +1,23 @@
|
||||
namespace CodeFirstExistingDatabase.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class AddCategoryColumnToCoursesTable : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.Courses", "Category_Id", c => c.Int());
|
||||
CreateIndex("dbo.Courses", "Category_Id");
|
||||
AddForeignKey("dbo.Courses", "Category_Id", "dbo.Categories", "Id");
|
||||
Sql("UPDATE Courses SET Category_Id = 1");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropForeignKey("dbo.Courses", "Category_Id", "dbo.Categories");
|
||||
DropIndex("dbo.Courses", new[] { "Category_Id" });
|
||||
DropColumn("dbo.Courses", "Category_Id");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user