YD_WeChatApplet.Api/WeChatApplet/Migrations/20250310071156_20250310v3.cs
2025-06-06 14:57:20 +08:00

112 lines
6.4 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace YD_WeChatApplet.Api.Migrations
{
public partial class _20250310v3 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "S_HomeWorkStudents");
migrationBuilder.DropTable(
name: "S_HomeWork");
migrationBuilder.RenameColumn(
name: "WorkStatus",
table: "WCA_ExerciseData",
newName: "Status");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "Status",
table: "WCA_ExerciseData",
newName: "WorkStatus");
migrationBuilder.CreateTable(
name: "S_HomeWork",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false, comment: "Id")
.Annotation("SqlServer:Identity", "1, 1"),
Amount = table.Column<int>(type: "int", nullable: false, comment: "作业数量"),
ClassId = table.Column<int>(type: "int", nullable: false, comment: "班级Id"),
ClassName = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "班级名称"),
CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, comment: "创建时间"),
Duration = table.Column<int>(type: "int", nullable: false, comment: "作业时长"),
EndTime = table.Column<DateTime>(type: "datetime", nullable: false, comment: "结束时间"),
GradeId = table.Column<int>(type: "int", nullable: false, comment: "年级Id"),
GradeName = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "年级名称"),
GroupNumber = table.Column<int>(type: "int", nullable: false, comment: "作业数量"),
IsRepeat = table.Column<bool>(type: "bit", nullable: false, comment: "是否重复"),
RepetitionPeriod = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "重复周期"),
SchoolCode = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "学校编号"),
StartTime = table.Column<DateTime>(type: "datetime", nullable: false, comment: "开始时间"),
StudentScope = table.Column<int>(type: "int", nullable: false, comment: "学生范围"),
TeacherId = table.Column<int>(type: "int", nullable: false, comment: "老师Id"),
TeacherName = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "老师名称"),
TeacherPhoneNo = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "老师手机号"),
WorkModeType = table.Column<int>(type: "int", nullable: false, comment: "作业类型"),
WorkModeTypeName = table.Column<string>(type: "nvarchar(200)", nullable: false, comment: "模式类型名称"),
WorkName = table.Column<string>(type: "nvarchar(200)", nullable: false, comment: "作业名称"),
WorkStatus = table.Column<int>(type: "int", nullable: false, comment: "作业状态"),
WorkText = table.Column<string>(type: "nvarchar(max)", nullable: false, comment: "作业内容"),
WorkType = table.Column<int>(type: "int", nullable: false, comment: "作业类型"),
WorkTypeName = table.Column<string>(type: "nvarchar(200)", nullable: false, comment: "作业类型名称")
},
constraints: table =>
{
table.PrimaryKey("PK_S_HomeWork", x => x.Id);
});
migrationBuilder.CreateTable(
name: "S_HomeWorkStudents",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false, comment: "Id")
.Annotation("SqlServer:Identity", "1, 1"),
HomeWorkId = table.Column<int>(type: "int", nullable: false),
Age = table.Column<int>(type: "int", nullable: true, comment: "年龄"),
Photo = table.Column<string>(type: "nvarchar(2000)", nullable: false, comment: "学生照片"),
SchoolCode = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "学校编号"),
Sex = table.Column<int>(type: "int", nullable: false, comment: "性别"),
StudentName = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "学生名称"),
StudentNo = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "学生学号"),
Value = table.Column<int>(type: "int", nullable: false, comment: "成绩"),
WCA_ExerciseDataId = table.Column<int>(type: "int", nullable: true),
WorkStatus = table.Column<int>(type: "int", nullable: false, comment: "学生作业状态")
},
constraints: table =>
{
table.PrimaryKey("PK_S_HomeWorkStudents", x => x.Id);
table.ForeignKey(
name: "FK_S_HomeWorkStudents_S_HomeWork_HomeWorkId",
column: x => x.HomeWorkId,
principalTable: "S_HomeWork",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_S_HomeWorkStudents_WCA_ExerciseData_WCA_ExerciseDataId",
column: x => x.WCA_ExerciseDataId,
principalTable: "WCA_ExerciseData",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_S_HomeWorkStudents_HomeWorkId",
table: "S_HomeWorkStudents",
column: "HomeWorkId");
migrationBuilder.CreateIndex(
name: "IX_S_HomeWorkStudents_WCA_ExerciseDataId",
table: "S_HomeWorkStudents",
column: "WCA_ExerciseDataId");
}
}
}