namespace Vrh.iScheduler.Report.Lib.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class RemoveSchGroup : DbMigration
    {
        public override void Up()
        {
            DropForeignKey("dbo.SchedulerReportPackages", "SchedulerReportPackageGroupId", "dbo.SchedulerReportPackageGroups");
            DropIndex("dbo.SchedulerReportPackages", new[] { "SchedulerReportPackageGroupId" });
            AddColumn("dbo.SchedulerReportPackages", "SchedulerReportPackageGroup", c => c.String());
            DropColumn("dbo.SchedulerReportPackages", "SchedulerReportPackageGroupId");
            DropTable("dbo.SchedulerReportPackageGroups");
        }
        
        public override void Down()
        {
            CreateTable(
                "dbo.SchedulerReportPackageGroups",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Name = c.String(nullable: false, maxLength: 100),
                    })
                .PrimaryKey(t => t.Id);
            
            AddColumn("dbo.SchedulerReportPackages", "SchedulerReportPackageGroupId", c => c.Int(nullable: false));
            DropColumn("dbo.SchedulerReportPackages", "SchedulerReportPackageGroup");
            CreateIndex("dbo.SchedulerReportPackages", "SchedulerReportPackageGroupId");
            AddForeignKey("dbo.SchedulerReportPackages", "SchedulerReportPackageGroupId", "dbo.SchedulerReportPackageGroups", "Id", cascadeDelete: true);
        }
    }
}
