using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Solicitors.Data.Migrations { /// public partial class InitialCreate : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Cities", columns: table => new { CityId = table.Column(type: "TEXT", nullable: false), Name = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Cities", x => x.CityId); }); migrationBuilder.CreateTable( name: "Solicitors", columns: table => new { SolicitorId = table.Column(type: "TEXT", nullable: false), Name = table.Column(type: "TEXT", nullable: false), RelativeUrl = table.Column(type: "TEXT", nullable: false), Phone = table.Column(type: "TEXT", nullable: true), Email = table.Column(type: "TEXT", nullable: true), Website = table.Column(type: "TEXT", nullable: true), ShortDescription = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Solicitors", x => x.SolicitorId); }); migrationBuilder.CreateTable( name: "CitySolicitor", columns: table => new { CitiesCityId = table.Column(type: "TEXT", nullable: false), SolicitorsSolicitorId = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_CitySolicitor", x => new { x.CitiesCityId, x.SolicitorsSolicitorId }); table.ForeignKey( name: "FK_CitySolicitor_Cities_CitiesCityId", column: x => x.CitiesCityId, principalTable: "Cities", principalColumn: "CityId", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_CitySolicitor_Solicitors_SolicitorsSolicitorId", column: x => x.SolicitorsSolicitorId, principalTable: "Solicitors", principalColumn: "SolicitorId", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "SolicitorLocations", columns: table => new { SolicitorLocationId = table.Column(type: "TEXT", nullable: false), Address = table.Column(type: "TEXT", nullable: false), Phone = table.Column(type: "TEXT", nullable: false), SolicitorId = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_SolicitorLocations", x => x.SolicitorLocationId); table.ForeignKey( name: "FK_SolicitorLocations_Solicitors_SolicitorId", column: x => x.SolicitorId, principalTable: "Solicitors", principalColumn: "SolicitorId", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "SolicitorRatings", columns: table => new { SolicitorRatingId = table.Column(type: "TEXT", nullable: false), Value = table.Column(type: "TEXT", nullable: false), Maximum = table.Column(type: "TEXT", nullable: false), Provider = table.Column(type: "TEXT", nullable: false), SolicitorId = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_SolicitorRatings", x => x.SolicitorRatingId); table.ForeignKey( name: "FK_SolicitorRatings_Solicitors_SolicitorId", column: x => x.SolicitorId, principalTable: "Solicitors", principalColumn: "SolicitorId", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "SolicitorLocationRatings", columns: table => new { SolicitorLocationRatingId = table.Column(type: "TEXT", nullable: false), Value = table.Column(type: "TEXT", nullable: false), Maximum = table.Column(type: "TEXT", nullable: false), Provider = table.Column(type: "TEXT", nullable: false), SolicitorLocationId = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_SolicitorLocationRatings", x => x.SolicitorLocationRatingId); table.ForeignKey( name: "FK_SolicitorLocationRatings_SolicitorLocations_SolicitorLocationId", column: x => x.SolicitorLocationId, principalTable: "SolicitorLocations", principalColumn: "SolicitorLocationId", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_CitySolicitor_SolicitorsSolicitorId", table: "CitySolicitor", column: "SolicitorsSolicitorId"); migrationBuilder.CreateIndex( name: "IX_SolicitorLocationRatings_SolicitorLocationId", table: "SolicitorLocationRatings", column: "SolicitorLocationId"); migrationBuilder.CreateIndex( name: "IX_SolicitorLocations_SolicitorId", table: "SolicitorLocations", column: "SolicitorId"); migrationBuilder.CreateIndex( name: "IX_SolicitorRatings_SolicitorId", table: "SolicitorRatings", column: "SolicitorId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "CitySolicitor"); migrationBuilder.DropTable( name: "SolicitorLocationRatings"); migrationBuilder.DropTable( name: "SolicitorRatings"); migrationBuilder.DropTable( name: "Cities"); migrationBuilder.DropTable( name: "SolicitorLocations"); migrationBuilder.DropTable( name: "Solicitors"); } } }