173 lines
7.4 KiB
C#
173 lines
7.4 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Solicitors.Data.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class InitialCreate : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Cities",
|
|
columns: table => new
|
|
{
|
|
CityId = table.Column<Guid>(type: "TEXT", nullable: false),
|
|
Name = table.Column<string>(type: "TEXT", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Cities", x => x.CityId);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Solicitors",
|
|
columns: table => new
|
|
{
|
|
SolicitorId = table.Column<Guid>(type: "TEXT", nullable: false),
|
|
Name = table.Column<string>(type: "TEXT", nullable: false),
|
|
RelativeUrl = table.Column<string>(type: "TEXT", nullable: false),
|
|
Phone = table.Column<string>(type: "TEXT", nullable: true),
|
|
Email = table.Column<string>(type: "TEXT", nullable: true),
|
|
Website = table.Column<string>(type: "TEXT", nullable: true),
|
|
ShortDescription = table.Column<string>(type: "TEXT", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Solicitors", x => x.SolicitorId);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "CitySolicitor",
|
|
columns: table => new
|
|
{
|
|
CitiesCityId = table.Column<Guid>(type: "TEXT", nullable: false),
|
|
SolicitorsSolicitorId = table.Column<Guid>(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<Guid>(type: "TEXT", nullable: false),
|
|
Address = table.Column<string>(type: "TEXT", nullable: false),
|
|
Phone = table.Column<string>(type: "TEXT", nullable: false),
|
|
SolicitorId = table.Column<Guid>(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<Guid>(type: "TEXT", nullable: false),
|
|
Value = table.Column<decimal>(type: "TEXT", nullable: false),
|
|
Maximum = table.Column<decimal>(type: "TEXT", nullable: false),
|
|
Provider = table.Column<string>(type: "TEXT", nullable: false),
|
|
SolicitorId = table.Column<Guid>(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<Guid>(type: "TEXT", nullable: false),
|
|
Value = table.Column<decimal>(type: "TEXT", nullable: false),
|
|
Maximum = table.Column<decimal>(type: "TEXT", nullable: false),
|
|
Provider = table.Column<string>(type: "TEXT", nullable: false),
|
|
SolicitorLocationId = table.Column<Guid>(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");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
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");
|
|
}
|
|
}
|
|
}
|