namespace HealthchoiceMVC.Migrations { using System; using System.Data.Entity.Migrations; public partial class _20191021 : DbMigration { public override void Up() { CreateTable( "dbo.PersonAddress", c => new { PersonAddressId = c.Int(nullable: false, identity: true), AddressLineOne = c.String(nullable: false), AddressLineTwo = c.String(nullable: false), AreaSuburb = c.String(maxLength: 50), CityTown = c.String(nullable: false, maxLength: 250), PostalCodeS = c.String(nullable: false, maxLength: 250), ActiveIndic = c.Short(nullable: false), PersonAddressType_PersonAddressTypeId = c.Int(nullable: false), PersonId_PersonId = c.Int(nullable: false), }) .PrimaryKey(t => t.PersonAddressId) .ForeignKey("dbo.PersonAddressType", t => t.PersonAddressType_PersonAddressTypeId, cascadeDelete: true) .ForeignKey("dbo.Person", t => t.PersonId_PersonId, cascadeDelete: true) .Index(t => t.PersonAddressType_PersonAddressTypeId) .Index(t => t.PersonId_PersonId); CreateTable( "dbo.PersonAddressType", c => new { PersonAddressTypeId = c.Int(nullable: false, identity: true), Description = c.String(nullable: false, maxLength: 50), }) .PrimaryKey(t => t.PersonAddressTypeId); AddColumn("dbo.PracticeLocation", "AddressLineOne", c => c.String(nullable: false)); AddColumn("dbo.PracticeLocation", "AddressLineTwo", c => c.String(nullable: false)); AddColumn("dbo.PracticeLocation", "AreaSuburb", c => c.String(maxLength: 50)); AddColumn("dbo.PracticeLocation", "CityTown", c => c.String(nullable: false, maxLength: 250)); AddColumn("dbo.PracticeLocation", "PostalCode", c => c.String(nullable: false, maxLength: 250)); AddColumn("dbo.Practice", "AffiliationNumber", c => c.String(nullable: false, maxLength: 8)); AddColumn("dbo.Practice", "AddressLineOne", c => c.String(nullable: false)); AddColumn("dbo.Practice", "AddressLineTwo", c => c.String(nullable: false)); AddColumn("dbo.Practice", "AreaSuburb", c => c.String(maxLength: 50)); AddColumn("dbo.Practice", "CityTown", c => c.String(nullable: false, maxLength: 250)); AddColumn("dbo.Practice", "PostalCode", c => c.String(nullable: false, maxLength: 250)); DropColumn("dbo.PracticeLocation", "LocationAddress"); DropColumn("dbo.Practice", "PracticeCorrespondenceAddress"); } public override void Down() { AddColumn("dbo.Practice", "PracticeCorrespondenceAddress", c => c.String(nullable: false, maxLength: 1000)); AddColumn("dbo.PracticeLocation", "LocationAddress", c => c.String(nullable: false, maxLength: 1000)); DropForeignKey("dbo.PersonAddress", "PersonId_PersonId", "dbo.Person"); DropForeignKey("dbo.PersonAddress", "PersonAddressType_PersonAddressTypeId", "dbo.PersonAddressType"); DropIndex("dbo.PersonAddress", new[] { "PersonId_PersonId" }); DropIndex("dbo.PersonAddress", new[] { "PersonAddressType_PersonAddressTypeId" }); DropColumn("dbo.Practice", "PostalCode"); DropColumn("dbo.Practice", "CityTown"); DropColumn("dbo.Practice", "AreaSuburb"); DropColumn("dbo.Practice", "AddressLineTwo"); DropColumn("dbo.Practice", "AddressLineOne"); DropColumn("dbo.Practice", "AffiliationNumber"); DropColumn("dbo.PracticeLocation", "PostalCode"); DropColumn("dbo.PracticeLocation", "CityTown"); DropColumn("dbo.PracticeLocation", "AreaSuburb"); DropColumn("dbo.PracticeLocation", "AddressLineTwo"); DropColumn("dbo.PracticeLocation", "AddressLineOne"); DropTable("dbo.PersonAddressType"); DropTable("dbo.PersonAddress"); } } }