namespace DataAccessLayer.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class Update4 : DbMigration
    {
        public override void Up()
        {
            DropForeignKey("dbo.TimeSheetRecords", "FromId", "dbo.AttendanceRecords");
            DropForeignKey("dbo.TimeSheetRecords", "ToId", "dbo.AttendanceRecords");
            DropIndex("dbo.TimeSheetRecords", new[] { "FromId" });
            DropIndex("dbo.TimeSheetRecords", new[] { "ToId" });
            AddColumn("dbo.TimeSheetRecords", "From", c => c.DateTime(nullable: false));
            AddColumn("dbo.TimeSheetRecords", "To", c => c.DateTime(nullable: false));
            AddColumn("dbo.TimeSheetRecords", "EmployeeId", c => c.Int(nullable: false));
            CreateIndex("dbo.TimeSheetRecords", "EmployeeId");
            AddForeignKey("dbo.TimeSheetRecords", "EmployeeId", "dbo.Employees", "Id", cascadeDelete: true);
            DropColumn("dbo.TimeSheetRecords", "FromId");
            DropColumn("dbo.TimeSheetRecords", "ToId");
        }
        
        public override void Down()
        {
            AddColumn("dbo.TimeSheetRecords", "ToId", c => c.Int(nullable: false));
            AddColumn("dbo.TimeSheetRecords", "FromId", c => c.Int(nullable: false));
            DropForeignKey("dbo.TimeSheetRecords", "EmployeeId", "dbo.Employees");
            DropIndex("dbo.TimeSheetRecords", new[] { "EmployeeId" });
            DropColumn("dbo.TimeSheetRecords", "EmployeeId");
            DropColumn("dbo.TimeSheetRecords", "To");
            DropColumn("dbo.TimeSheetRecords", "From");
            CreateIndex("dbo.TimeSheetRecords", "ToId");
            CreateIndex("dbo.TimeSheetRecords", "FromId");
            AddForeignKey("dbo.TimeSheetRecords", "ToId", "dbo.AttendanceRecords", "Id");
            AddForeignKey("dbo.TimeSheetRecords", "FromId", "dbo.AttendanceRecords", "Id");
        }
    }
}
