namespace CARRE_DSS2.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class patients1 : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Patients",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        UserName = c.String(),
                        GraphName = c.String(),
                        Email = c.String(),
                        Token = c.String(),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.PatientApplicationUsers",
                c => new
                    {
                        Patient_Id = c.Int(nullable: false),
                        ApplicationUser_Id = c.String(nullable: false, maxLength: 128),
                    })
                .PrimaryKey(t => new { t.Patient_Id, t.ApplicationUser_Id })
                .ForeignKey("dbo.Patients", t => t.Patient_Id, cascadeDelete: true)
                .ForeignKey("dbo.AspNetUsers", t => t.ApplicationUser_Id, cascadeDelete: true)
                .Index(t => t.Patient_Id)
                .Index(t => t.ApplicationUser_Id);
            
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.PatientApplicationUsers", "ApplicationUser_Id", "dbo.AspNetUsers");
            DropForeignKey("dbo.PatientApplicationUsers", "Patient_Id", "dbo.Patients");
            DropIndex("dbo.PatientApplicationUsers", new[] { "ApplicationUser_Id" });
            DropIndex("dbo.PatientApplicationUsers", new[] { "Patient_Id" });
            DropTable("dbo.PatientApplicationUsers");
            DropTable("dbo.Patients");
        }
    }
}
