132 lines
5.0 KiB
C#
132 lines
5.0 KiB
C#
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Marco.Pms.DataAccess.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class Removed_WorkItemMapping : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_TaskAllocations_WorkItemMapping_WorkItemMappingId",
|
|
table: "TaskAllocations");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "WorkItemMapping");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_TaskAllocations_WorkItemMappingId",
|
|
table: "TaskAllocations");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "WorkItemMappingId",
|
|
table: "TaskAllocations");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "Description",
|
|
table: "TaskAllocations",
|
|
type: "longtext",
|
|
nullable: true,
|
|
oldClrType: typeof(string),
|
|
oldType: "longtext")
|
|
.Annotation("MySql:CharSet", "utf8mb4")
|
|
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.UpdateData(
|
|
table: "TaskAllocations",
|
|
keyColumn: "Description",
|
|
keyValue: null,
|
|
column: "Description",
|
|
value: "");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "Description",
|
|
table: "TaskAllocations",
|
|
type: "longtext",
|
|
nullable: false,
|
|
oldClrType: typeof(string),
|
|
oldType: "longtext",
|
|
oldNullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4")
|
|
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "WorkItemMappingId",
|
|
table: "TaskAllocations",
|
|
type: "int",
|
|
nullable: false,
|
|
defaultValue: 0);
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "WorkItemMapping",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
TenantId = table.Column<int>(type: "int", nullable: false),
|
|
WorkAreaId = table.Column<int>(type: "int", nullable: false),
|
|
WorkItemId = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_WorkItemMapping", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_WorkItemMapping_Tenants_TenantId",
|
|
column: x => x.TenantId,
|
|
principalTable: "Tenants",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_WorkItemMapping_WorkAreas_WorkAreaId",
|
|
column: x => x.WorkAreaId,
|
|
principalTable: "WorkAreas",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_WorkItemMapping_WorkItems_WorkItemId",
|
|
column: x => x.WorkItemId,
|
|
principalTable: "WorkItems",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_TaskAllocations_WorkItemMappingId",
|
|
table: "TaskAllocations",
|
|
column: "WorkItemMappingId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_WorkItemMapping_TenantId",
|
|
table: "WorkItemMapping",
|
|
column: "TenantId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_WorkItemMapping_WorkAreaId",
|
|
table: "WorkItemMapping",
|
|
column: "WorkAreaId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_WorkItemMapping_WorkItemId",
|
|
table: "WorkItemMapping",
|
|
column: "WorkItemId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_TaskAllocations_WorkItemMapping_WorkItemMappingId",
|
|
table: "TaskAllocations",
|
|
column: "WorkItemMappingId",
|
|
principalTable: "WorkItemMapping",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
}
|
|
}
|