namespace MazinOfficeApp.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class CompanyandCostCenterRelationshipadded : DbMigration
    {
        public override void Up()
        {
            DropForeignKey("dbo.CostCenters", "Company_Id", "dbo.Companies");
            DropIndex("dbo.CostCenters", new[] { "Company_Id" });
            RenameColumn(table: "dbo.CostCenters", name: "Company_Id", newName: "CompanyId");
            AlterColumn("dbo.CostCenters", "CompanyId", c => c.Int(nullable: false));
            CreateIndex("dbo.CostCenters", "CompanyId");
            AddForeignKey("dbo.CostCenters", "CompanyId", "dbo.Companies", "Id", cascadeDelete: true);
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.CostCenters", "CompanyId", "dbo.Companies");
            DropIndex("dbo.CostCenters", new[] { "CompanyId" });
            AlterColumn("dbo.CostCenters", "CompanyId", c => c.Int());
            RenameColumn(table: "dbo.CostCenters", name: "CompanyId", newName: "Company_Id");
            CreateIndex("dbo.CostCenters", "Company_Id");
            AddForeignKey("dbo.CostCenters", "Company_Id", "dbo.Companies", "Id");
        }
    }
}
