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(type: "int", nullable: false, comment: "Id") .Annotation("SqlServer:Identity", "1, 1"), Amount = table.Column(type: "int", nullable: false, comment: "作业数量"), ClassId = table.Column(type: "int", nullable: false, comment: "班级Id"), ClassName = table.Column(type: "nvarchar(100)", nullable: false, comment: "班级名称"), CreateTime = table.Column(type: "datetime", nullable: false, comment: "创建时间"), Duration = table.Column(type: "int", nullable: false, comment: "作业时长"), EndTime = table.Column(type: "datetime", nullable: false, comment: "结束时间"), GradeId = table.Column(type: "int", nullable: false, comment: "年级Id"), GradeName = table.Column(type: "nvarchar(100)", nullable: false, comment: "年级名称"), GroupNumber = table.Column(type: "int", nullable: false, comment: "作业数量"), IsRepeat = table.Column(type: "bit", nullable: false, comment: "是否重复"), RepetitionPeriod = table.Column(type: "nvarchar(100)", nullable: false, comment: "重复周期"), SchoolCode = table.Column(type: "nvarchar(100)", nullable: false, comment: "学校编号"), StartTime = table.Column(type: "datetime", nullable: false, comment: "开始时间"), StudentScope = table.Column(type: "int", nullable: false, comment: "学生范围"), TeacherId = table.Column(type: "int", nullable: false, comment: "老师Id"), TeacherName = table.Column(type: "nvarchar(100)", nullable: false, comment: "老师名称"), TeacherPhoneNo = table.Column(type: "nvarchar(100)", nullable: false, comment: "老师手机号"), WorkModeType = table.Column(type: "int", nullable: false, comment: "作业类型"), WorkModeTypeName = table.Column(type: "nvarchar(200)", nullable: false, comment: "模式类型名称"), WorkName = table.Column(type: "nvarchar(200)", nullable: false, comment: "作业名称"), WorkStatus = table.Column(type: "int", nullable: false, comment: "作业状态"), WorkText = table.Column(type: "nvarchar(max)", nullable: false, comment: "作业内容"), WorkType = table.Column(type: "int", nullable: false, comment: "作业类型"), WorkTypeName = table.Column(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(type: "int", nullable: false, comment: "Id") .Annotation("SqlServer:Identity", "1, 1"), HomeWorkId = table.Column(type: "int", nullable: false), Age = table.Column(type: "int", nullable: true, comment: "年龄"), Photo = table.Column(type: "nvarchar(2000)", nullable: false, comment: "学生照片"), SchoolCode = table.Column(type: "nvarchar(100)", nullable: false, comment: "学校编号"), Sex = table.Column(type: "int", nullable: false, comment: "性别"), StudentName = table.Column(type: "nvarchar(100)", nullable: false, comment: "学生名称"), StudentNo = table.Column(type: "nvarchar(100)", nullable: false, comment: "学生学号"), Value = table.Column(type: "int", nullable: false, comment: "成绩"), WCA_ExerciseDataId = table.Column(type: "int", nullable: true), WorkStatus = table.Column(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"); } } }