Divar geo-coords to facility map + medical gate + RawListing FK/geo migrations
CI/CD / CI · dotnet build (push) Successful in 2m6s
CI/CD / Deploy · hamkadr (push) Successful in 2m3s

This commit is contained in:
soroush.asadi
2026-06-09 21:38:55 +03:30
parent cf5e0011c4
commit 380243b669
14 changed files with 3567 additions and 36 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,69 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace JobsMedical.Web.Migrations
{
/// <inheritdoc />
public partial class RawListingLinkFks : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_RawListings_Shifts_LinkedShiftId",
table: "RawListings");
// LinkedTalentId never had an FK before, so existing rows may point at deleted talent.
// Null those orphans first, otherwise AddForeignKey below fails on a populated DB.
migrationBuilder.Sql(
"UPDATE \"RawListings\" r SET \"LinkedTalentId\" = NULL " +
"WHERE r.\"LinkedTalentId\" IS NOT NULL " +
"AND NOT EXISTS (SELECT 1 FROM \"TalentListings\" t WHERE t.\"Id\" = r.\"LinkedTalentId\");");
migrationBuilder.CreateIndex(
name: "IX_RawListings_LinkedTalentId",
table: "RawListings",
column: "LinkedTalentId");
migrationBuilder.AddForeignKey(
name: "FK_RawListings_Shifts_LinkedShiftId",
table: "RawListings",
column: "LinkedShiftId",
principalTable: "Shifts",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_RawListings_TalentListings_LinkedTalentId",
table: "RawListings",
column: "LinkedTalentId",
principalTable: "TalentListings",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_RawListings_Shifts_LinkedShiftId",
table: "RawListings");
migrationBuilder.DropForeignKey(
name: "FK_RawListings_TalentListings_LinkedTalentId",
table: "RawListings");
migrationBuilder.DropIndex(
name: "IX_RawListings_LinkedTalentId",
table: "RawListings");
migrationBuilder.AddForeignKey(
name: "FK_RawListings_Shifts_LinkedShiftId",
table: "RawListings",
column: "LinkedShiftId",
principalTable: "Shifts",
principalColumn: "Id");
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,38 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace JobsMedical.Web.Migrations
{
/// <inheritdoc />
public partial class RawListingGeo : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<double>(
name: "Lat",
table: "RawListings",
type: "double precision",
nullable: true);
migrationBuilder.AddColumn<double>(
name: "Lng",
table: "RawListings",
type: "double precision",
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Lat",
table: "RawListings");
migrationBuilder.DropColumn(
name: "Lng",
table: "RawListings");
}
}
}
@@ -748,12 +748,18 @@ namespace JobsMedical.Web.Migrations
b.Property<DateTime>("FetchedAt")
.HasColumnType("timestamp with time zone");
b.Property<double?>("Lat")
.HasColumnType("double precision");
b.Property<int?>("LinkedShiftId")
.HasColumnType("integer");
b.Property<int?>("LinkedTalentId")
.HasColumnType("integer");
b.Property<double?>("Lng")
.HasColumnType("double precision");
b.Property<string>("ParsedJson")
.HasColumnType("text");
@@ -783,6 +789,8 @@ namespace JobsMedical.Web.Migrations
b.HasIndex("LinkedShiftId");
b.HasIndex("LinkedTalentId");
b.HasIndex("Status");
b.ToTable("RawListings");
@@ -1415,9 +1423,17 @@ namespace JobsMedical.Web.Migrations
{
b.HasOne("JobsMedical.Web.Models.Shift", "LinkedShift")
.WithMany()
.HasForeignKey("LinkedShiftId");
.HasForeignKey("LinkedShiftId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("JobsMedical.Web.Models.TalentListing", "LinkedTalent")
.WithMany()
.HasForeignKey("LinkedTalentId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("LinkedShift");
b.Navigation("LinkedTalent");
});
modelBuilder.Entity("JobsMedical.Web.Models.Review", b =>