namespace FotbalPortal.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class addComments : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Comments",
                c => new
                    {
                        id = c.Int(nullable: false, identity: true),
                        author = c.Int(nullable: false),
                        disabled = c.Boolean(nullable: false),
                        text = c.String(),
                        created = c.DateTime(nullable: false),
                        articleID = c.Int(nullable: false),
                        reactOnID = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.id)
                .ForeignKey("dbo.Articles", t => t.articleID, cascadeDelete: true)
                .ForeignKey("dbo.Comments", t => t.reactOnID)
                .Index(t => t.articleID)
                .Index(t => t.reactOnID);
            
        }
        
        public override void Down()
        {
            DropIndex("dbo.Comments", new[] { "reactOnID" });
            DropIndex("dbo.Comments", new[] { "articleID" });
            DropForeignKey("dbo.Comments", "reactOnID", "dbo.Comments");
            DropForeignKey("dbo.Comments", "articleID", "dbo.Articles");
            DropTable("dbo.Comments");
        }
    }
}
