namespace WebApplication1.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class AddTopicSuggestions : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.TopicSuggestions",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        MentorId = c.String(nullable: false, maxLength: 128),
                        Title = c.String(nullable: false, maxLength: 200),
                        Description = c.String(maxLength: 2000),
                        IsAssigned = c.Boolean(nullable: false),
                        AssignedStudentId = c.String(maxLength: 128),
                        CreatedAt = c.DateTime(nullable: false),
                        AssignedAt = c.DateTime(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.AspNetUsers", t => t.AssignedStudentId)
                .ForeignKey("dbo.AspNetUsers", t => t.MentorId)
                .Index(t => t.MentorId)
                .Index(t => t.AssignedStudentId);
            
            AddColumn("dbo.MentorContacts", "TopicSuggestionId", c => c.Int());
            CreateIndex("dbo.MentorContacts", "TopicSuggestionId");
            AddForeignKey("dbo.MentorContacts", "TopicSuggestionId", "dbo.TopicSuggestions", "Id");
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.MentorContacts", "TopicSuggestionId", "dbo.TopicSuggestions");
            DropForeignKey("dbo.TopicSuggestions", "MentorId", "dbo.AspNetUsers");
            DropForeignKey("dbo.TopicSuggestions", "AssignedStudentId", "dbo.AspNetUsers");
            DropIndex("dbo.TopicSuggestions", new[] { "AssignedStudentId" });
            DropIndex("dbo.TopicSuggestions", new[] { "MentorId" });
            DropIndex("dbo.MentorContacts", new[] { "TopicSuggestionId" });
            DropColumn("dbo.MentorContacts", "TopicSuggestionId");
            DropTable("dbo.TopicSuggestions");
        }
    }
}
