using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Jiaowu.Api.Infrastructure.Persistence.Migrations.MySql
{
///
public partial class SchedulePublishJobs : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "SchedulePublishJobs",
columns: table => new
{
Id = table.Column(type: "char(36)", nullable: false),
SchedulePlanId = table.Column(type: "char(36)", nullable: false),
AcademicTermId = table.Column(type: "char(36)", nullable: false),
ActiveAcademicTermId = table.Column(type: "char(36)", nullable: true),
RequestedByUserId = table.Column(type: "char(36)", nullable: true),
Status = table.Column(type: "int", nullable: false),
TotalSteps = table.Column(type: "int", nullable: false),
CompletedSteps = table.Column(type: "int", nullable: false),
CurrentStep = table.Column(type: "varchar(200)", maxLength: 200, nullable: true),
ErrorMessage = table.Column(type: "varchar(2000)", maxLength: 2000, nullable: true),
StartedAt = table.Column(type: "datetime(6)", nullable: true),
CompletedAt = table.Column(type: "datetime(6)", nullable: true),
CreatedAt = table.Column(type: "datetime(6)", nullable: false),
UpdatedAt = table.Column(type: "datetime(6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SchedulePublishJobs", x => x.Id);
table.ForeignKey(
name: "FK_SchedulePublishJobs_AspNetUsers_RequestedByUserId",
column: x => x.RequestedByUserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_SchedulePublishJobs_SchedulePlans_SchedulePlanId",
column: x => x.SchedulePlanId,
principalTable: "SchedulePlans",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySQL:Charset", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_SchedulePublishJobs_ActiveAcademicTermId",
table: "SchedulePublishJobs",
column: "ActiveAcademicTermId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_SchedulePublishJobs_RequestedByUserId",
table: "SchedulePublishJobs",
column: "RequestedByUserId");
migrationBuilder.CreateIndex(
name: "IX_SchedulePublishJobs_SchedulePlanId_CreatedAt",
table: "SchedulePublishJobs",
columns: new[] { "SchedulePlanId", "CreatedAt" });
migrationBuilder.CreateIndex(
name: "IX_SchedulePublishJobs_Status_CreatedAt",
table: "SchedulePublishJobs",
columns: new[] { "Status", "CreatedAt" });
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "SchedulePublishJobs");
}
}
}