namespace FotbalPortal.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class addArticle : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Articles",
                c => new
                    {
                        id = c.Int(nullable: false, identity: true),
                        author = c.Int(nullable: false),
                        status = c.Int(nullable: false),
                        title = c.String(),
                        text = c.String(),
                        created = c.DateTime(nullable: false),
                        edited = c.DateTime(),
                        published = c.DateTime(),
                        commentsAllowed = c.Boolean(nullable: false),
                        categoryID = c.Int(nullable: false),
                        image = c.String(),
                    })
                .PrimaryKey(t => t.id)
                .ForeignKey("dbo.Categories", t => t.categoryID, cascadeDelete: true)
                .Index(t => t.categoryID);
            
        }
        
        public override void Down()
        {
            DropIndex("dbo.Articles", new[] { "categoryID" });
            DropForeignKey("dbo.Articles", "categoryID", "dbo.Categories");
            DropTable("dbo.Articles");
        }
    }
}
