126 lines
6.1 KiB
C#
126 lines
6.1 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Jiaowu.Api.Infrastructure.Persistence.Migrations.MySql
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class CourseAdjustments : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "CourseAdjustments",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "char(36)", nullable: false),
|
|
TeachingTaskId = table.Column<Guid>(type: "char(36)", nullable: false),
|
|
Type = table.Column<int>(type: "int", nullable: false),
|
|
Status = table.Column<int>(type: "int", nullable: false),
|
|
ApplicantUserId = table.Column<Guid>(type: "char(36)", nullable: false),
|
|
TargetDate = table.Column<DateOnly>(type: "date", nullable: true),
|
|
DayOfWeek = table.Column<int>(type: "int", nullable: true),
|
|
StartPeriod = table.Column<int>(type: "int", nullable: true),
|
|
PeriodCount = table.Column<int>(type: "int", nullable: true),
|
|
ClassroomId = table.Column<Guid>(type: "char(36)", nullable: true),
|
|
SubstituteTeacherId = table.Column<Guid>(type: "char(36)", nullable: true),
|
|
CancelWeek = table.Column<int>(type: "int", nullable: true),
|
|
CancelDate = table.Column<DateOnly>(type: "date", nullable: true),
|
|
Reason = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: false),
|
|
ReviewComment = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: true),
|
|
SubmittedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
|
ReviewedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
|
ReviewedByUserId = table.Column<Guid>(type: "char(36)", nullable: true),
|
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
UpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_CourseAdjustments", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_CourseAdjustments_Classrooms_ClassroomId",
|
|
column: x => x.ClassroomId,
|
|
principalTable: "Classrooms",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.SetNull);
|
|
table.ForeignKey(
|
|
name: "FK_CourseAdjustments_Teachers_SubstituteTeacherId",
|
|
column: x => x.SubstituteTeacherId,
|
|
principalTable: "Teachers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.SetNull);
|
|
table.ForeignKey(
|
|
name: "FK_CourseAdjustments_TeachingTasks_TeachingTaskId",
|
|
column: x => x.TeachingTaskId,
|
|
principalTable: "TeachingTasks",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
})
|
|
.Annotation("MySQL:Charset", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Notifications",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "char(36)", nullable: false),
|
|
UserId = table.Column<Guid>(type: "char(36)", nullable: false),
|
|
Title = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false),
|
|
Content = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: false),
|
|
IsRead = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
LinkUrl = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: true),
|
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
UpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Notifications", x => x.Id);
|
|
})
|
|
.Annotation("MySQL:Charset", "utf8mb4");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_CourseAdjustments_ApplicantUserId",
|
|
table: "CourseAdjustments",
|
|
column: "ApplicantUserId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_CourseAdjustments_ClassroomId",
|
|
table: "CourseAdjustments",
|
|
column: "ClassroomId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_CourseAdjustments_Status_CreatedAt",
|
|
table: "CourseAdjustments",
|
|
columns: new[] { "Status", "CreatedAt" });
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_CourseAdjustments_SubstituteTeacherId",
|
|
table: "CourseAdjustments",
|
|
column: "SubstituteTeacherId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_CourseAdjustments_TeachingTaskId_Status",
|
|
table: "CourseAdjustments",
|
|
columns: new[] { "TeachingTaskId", "Status" });
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Notifications_CreatedAt",
|
|
table: "Notifications",
|
|
column: "CreatedAt");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Notifications_UserId_IsRead",
|
|
table: "Notifications",
|
|
columns: new[] { "UserId", "IsRead" });
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(name: "Notifications");
|
|
migrationBuilder.DropTable(name: "CourseAdjustments");
|
|
}
|
|
}
|
|
}
|