Movies included in database as well and handled in site
This commit is contained in:
32
Vidly/Migrations/201901201322198_MovieGenreAdded.cs
Normal file
32
Vidly/Migrations/201901201322198_MovieGenreAdded.cs
Normal file
@ -0,0 +1,32 @@
|
||||
namespace Vidly.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class MovieGenreAdded : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
CreateTable(
|
||||
"dbo.MovieGenres",
|
||||
c => new
|
||||
{
|
||||
Id = c.Byte(nullable: false),
|
||||
Name = c.String(),
|
||||
})
|
||||
.PrimaryKey(t => t.Id);
|
||||
|
||||
AddColumn("dbo.Movies", "MovieGenreId", c => c.Byte(nullable: false));
|
||||
CreateIndex("dbo.Movies", "MovieGenreId");
|
||||
AddForeignKey("dbo.Movies", "MovieGenreId", "dbo.MovieGenres", "Id", cascadeDelete: true);
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropForeignKey("dbo.Movies", "MovieGenreId", "dbo.MovieGenres");
|
||||
DropIndex("dbo.Movies", new[] { "MovieGenreId" });
|
||||
DropColumn("dbo.Movies", "MovieGenreId");
|
||||
DropTable("dbo.MovieGenres");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user