namespace TP02Photo_sharing.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class M3 : DbMigration
    {
        public override void Up()
        {
            DropForeignKey("dbo.Comments", "photo_ID", "dbo.Photos");
            DropIndex("dbo.Comments", new[] { "photo_ID" });
            RenameColumn(table: "dbo.Comments", name: "photo_ID", newName: "PhotoID");
            AlterColumn("dbo.Comments", "PhotoID", c => c.Int(nullable: false));
            CreateIndex("dbo.Comments", "PhotoID");
            AddForeignKey("dbo.Comments", "PhotoID", "dbo.Photos", "ID", cascadeDelete: true);
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.Comments", "PhotoID", "dbo.Photos");
            DropIndex("dbo.Comments", new[] { "PhotoID" });
            AlterColumn("dbo.Comments", "PhotoID", c => c.Int());
            RenameColumn(table: "dbo.Comments", name: "PhotoID", newName: "photo_ID");
            CreateIndex("dbo.Comments", "photo_ID");
            AddForeignKey("dbo.Comments", "photo_ID", "dbo.Photos", "ID");
        }
    }
}
