add initial migration for BugSection and BugDocuments tables

This commit is contained in:
2026-01-27 18:53:21 +03:30
parent 25aa76b16c
commit 23d42bd8f5
3 changed files with 1302 additions and 2 deletions

View File

@@ -0,0 +1,77 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace GozareshgirProgramManager.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class BugSectionInit : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "BugSections",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
InitialDescription = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
Status = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
OriginalAssignedUserId = table.Column<long>(type: "bigint", nullable: false),
Priority = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BugSections", x => x.Id);
table.ForeignKey(
name: "FK_BugSections_ProjectTasks_TaskId",
column: x => x.TaskId,
principalTable: "ProjectTasks",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "BugDocuments",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
FileId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
BugSectionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BugDocuments", x => x.Id);
table.ForeignKey(
name: "FK_BugDocuments_BugSections_BugSectionId",
column: x => x.BugSectionId,
principalTable: "BugSections",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_BugDocuments_BugSectionId",
table: "BugDocuments",
column: "BugSectionId");
migrationBuilder.CreateIndex(
name: "IX_BugSections_TaskId",
table: "BugSections",
column: "TaskId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "BugDocuments");
migrationBuilder.DropTable(
name: "BugSections");
}
}
}

View File

@@ -227,6 +227,41 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
b.ToTable("UploadedFiles", (string)null); b.ToTable("UploadedFiles", (string)null);
}); });
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.BugSection", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationDate")
.HasColumnType("datetime2");
b.Property<string>("InitialDescription")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<long>("OriginalAssignedUserId")
.HasColumnType("bigint");
b.Property<string>("Priority")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Status")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<Guid>("TaskId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("TaskId");
b.ToTable("BugSections", (string)null);
});
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.PhaseSection", b => modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.PhaseSection", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@@ -251,7 +286,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
b.HasIndex("SkillId"); b.HasIndex("SkillId");
b.ToTable("PhaseSections", (string)null); b.ToTable("PhaseSections");
}); });
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.ProjectPhase", b => modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.ProjectPhase", b =>
@@ -371,7 +406,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
b.HasIndex("SkillId"); b.HasIndex("SkillId");
b.ToTable("ProjectSections", (string)null); b.ToTable("ProjectSections");
}); });
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.ProjectTask", b => modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.ProjectTask", b =>
@@ -867,6 +902,43 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
b.ToTable("UserRefreshTokens", (string)null); b.ToTable("UserRefreshTokens", (string)null);
}); });
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.BugSection", b =>
{
b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectTask", "ProjectTask")
.WithMany("BugSectionList")
.HasForeignKey("TaskId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsMany("GozareshgirProgramManager.Domain.ProjectAgg.Entities.BugDocument", "BugDocuments", b1 =>
{
b1.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b1.Property<Guid>("BugSectionId")
.HasColumnType("uniqueidentifier");
b1.Property<Guid>("FileId")
.HasColumnType("uniqueidentifier");
b1.HasKey("Id");
b1.HasIndex("BugSectionId");
b1.ToTable("BugDocuments", (string)null);
b1.WithOwner("BugSection")
.HasForeignKey("BugSectionId");
b1.Navigation("BugSection");
});
b.Navigation("BugDocuments");
b.Navigation("ProjectTask");
});
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.PhaseSection", b => modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.PhaseSection", b =>
{ {
b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectPhase", "Phase") b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectPhase", "Phase")
@@ -1170,6 +1242,8 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.ProjectTask", b => modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.ProjectTask", b =>
{ {
b.Navigation("BugSectionList");
b.Navigation("Sections"); b.Navigation("Sections");
}); });