using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace YD_WeChatApplet.Api.Migrations.SmartSports { public partial class _20250226v1 : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "S_Class", columns: table => new { Id = table.Column(type: "int", nullable: false, comment: "Id") .Annotation("SqlServer:Identity", "1, 1"), SchoolCode = table.Column(type: "nvarchar(100)", nullable: false, comment: "学校编号"), GradeId = table.Column(type: "int", nullable: false, comment: "年级Id"), GradeName = table.Column(type: "nvarchar(100)", nullable: false, comment: "年级名称"), ClassName = table.Column(type: "nvarchar(100)", nullable: false, comment: "班级名称"), Remarks = table.Column(type: "text", nullable: true, comment: "备注"), Creator = table.Column(type: "int)", nullable: true, comment: "创建人"), CreateDate = table.Column(type: "datetime", nullable: true, comment: "创建时间"), Modifier = table.Column(type: "int)", nullable: true, comment: "修改人"), ModifyDate = table.Column(type: "datetime", nullable: true, comment: "修改时间") }, constraints: table => { table.PrimaryKey("PK_S_Class", x => x.Id); }); migrationBuilder.CreateTable( name: "S_ClassAssocTeacher", columns: table => new { Id = table.Column(type: "int", nullable: false, comment: "Id") .Annotation("SqlServer:Identity", "1, 1"), ClassId = table.Column(type: "int", nullable: false, comment: "班级Id"), TeacherId = table.Column(type: "int", nullable: false, comment: "老师Id"), Creator = table.Column(type: "int)", nullable: false, comment: "创建人"), CreateDate = table.Column(type: "datetime", nullable: true, comment: "创建时间"), Modifier = table.Column(type: "int)", nullable: false, comment: "修改人"), ModifyDate = table.Column(type: "datetime", nullable: true, comment: "修改时间"), Remarks = table.Column(type: "text", nullable: true, comment: "备注") }, constraints: table => { table.PrimaryKey("PK_S_ClassAssocTeacher", x => x.Id); }); migrationBuilder.CreateTable( name: "S_HomeWork", columns: table => new { Id = table.Column(type: "int", nullable: false, comment: "Id") .Annotation("SqlServer:Identity", "1, 1"), SchoolCode = table.Column(type: "nvarchar(100)", nullable: false, comment: "学校编号"), WorkName = table.Column(type: "nvarchar(200)", 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: "作业类型名称"), Duration = table.Column(type: "int", nullable: false, comment: "作业时长"), Amount = table.Column(type: "int", 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: "重复周期"), WorkStatus = table.Column(type: "int", 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: "老师手机号"), GradeId = table.Column(type: "int", nullable: false, comment: "年级Id"), GradeName = table.Column(type: "nvarchar(100)", nullable: false, comment: "年级名称"), ClassId = table.Column(type: "int", nullable: false, comment: "班级Id"), ClassName = table.Column(type: "nvarchar(100)", nullable: false, comment: "班级名称"), StartTime = table.Column(type: "datetime", nullable: false, comment: "开始时间"), EndTime = table.Column(type: "datetime", nullable: false, comment: "结束时间") }, constraints: table => { table.PrimaryKey("PK_S_HomeWork", x => x.Id); }); migrationBuilder.CreateTable( name: "S_Student", columns: table => new { Id = table.Column(type: "int", nullable: false, comment: "Id") .Annotation("SqlServer:Identity", "1, 1"), SchoolCode = table.Column(type: "nvarchar(100)", nullable: false, comment: "学校编号"), ClassId = table.Column(type: "int", nullable: false, comment: "班级Id"), ClassName = table.Column(type: "nvarchar(100)", nullable: false, comment: "班级名称"), StudentNo = table.Column(type: "nvarchar(100)", nullable: false, comment: "学生学号"), SchoolRollNo = table.Column(type: "nvarchar(100)", nullable: true, comment: "学籍号"), PlaceSchoolRollNo = table.Column(type: "nvarchar(100)", nullable: true, comment: "地方学籍号"), HeartRateFrontNo = table.Column(type: "nvarchar(100)", nullable: true, comment: "心率设备正面编号"), HeartRateId = table.Column(type: "nvarchar(100)", nullable: true, comment: "心率设备ID"), HeartRateQRCode = table.Column(type: "nvarchar(100)", nullable: true, comment: "心率设备二维码编号"), RopeSkipQRCode = table.Column(type: "nvarchar(100)", nullable: true, comment: "跳绳编号"), RopeSkipNo = table.Column(type: "nvarchar(100)", nullable: true, comment: "跳绳二维码编号"), RunChipNo = table.Column(type: "nvarchar(100)", nullable: true, comment: "中长跑芯片编号"), TotalTrainTime = table.Column(type: "float", nullable: true, comment: "训练时长"), TotalTrainNumber = table.Column(type: "int", nullable: true, comment: "训练次数"), IDCard = table.Column(type: "nvarchar(50)", nullable: true, comment: "身份证"), StudentNation = table.Column(type: "nvarchar(50)", nullable: true, comment: "学生名族"), StudentName = table.Column(type: "nvarchar(100)", nullable: false, comment: "学生名称"), Age = table.Column(type: "int", nullable: false, comment: "年龄"), Sex = table.Column(type: "int", nullable: false, comment: "性别"), Photo = table.Column(type: "nvarchar(2000)", nullable: false, comment: "学生照片"), Nation = table.Column(type: "nvarchar(20)", nullable: true, comment: "民族"), HomeAddress = table.Column(type: "nvarchar(200)", nullable: true, comment: "家庭住址"), StudentStatus = table.Column(type: "int", nullable: false, comment: "状态"), Birthday = table.Column(type: "datetime", nullable: true, comment: "出生日期"), ParentName = table.Column(type: "nvarchar(20)", nullable: true, comment: "家长姓名"), ParentPhoneNo = table.Column(type: "nvarchar(20)", nullable: true, comment: "家长联系方式"), AppletPwd = table.Column(type: "nvarchar(100)", nullable: true, comment: "小程序密码"), Remarks = table.Column(type: "text", nullable: true, comment: "备注"), Creator = table.Column(type: "int)", nullable: false, comment: "创建人"), CreateDate = table.Column(type: "datetime", nullable: true, comment: "创建时间"), Modifier = table.Column(type: "int)", nullable: false, comment: "修改人"), ModifyDate = table.Column(type: "datetime", nullable: true, comment: "修改时间") }, constraints: table => { table.PrimaryKey("PK_S_Student", x => x.Id); }); migrationBuilder.CreateTable( name: "S_SubmittedAssignments", columns: table => new { Id = table.Column(type: "int", nullable: false, comment: "Id") .Annotation("SqlServer:Identity", "1, 1"), SchoolCode = table.Column(type: "nvarchar(100)", nullable: false, comment: "学校编号"), HomeWorkId = table.Column(type: "int", nullable: false, comment: "作业Id"), StudentNo = table.Column(type: "nvarchar(100)", nullable: false, comment: "学生学号"), FileType = table.Column(type: "int", nullable: false, comment: "文件类型"), FileSize = table.Column(type: "int", nullable: true, comment: "文件大小"), FileName = table.Column(type: "nvarchar(200)", nullable: false, comment: "文件名称"), FilePath = table.Column(type: "nvarchar(2000)", nullable: false, comment: "文件地址") }, constraints: table => { table.PrimaryKey("PK_S_SubmittedAssignments", x => x.Id); }); migrationBuilder.CreateTable( name: "S_Teacher", columns: table => new { Id = table.Column(type: "int", nullable: false, comment: "Id") .Annotation("SqlServer:Identity", "1, 1"), SchoolCode = table.Column(type: "nvarchar(100)", nullable: false, comment: "学校编号"), TeacherName = table.Column(type: "nvarchar(100)", nullable: false, comment: "教师名称"), Age = table.Column(type: "int", nullable: false, comment: "教师年龄"), Sex = table.Column(type: "int", nullable: false, comment: "教师性别"), TeacherStatus = table.Column(type: "int", nullable: false, comment: "状态"), TeacherPhoto = table.Column(type: "nvarchar(2000)", nullable: true, comment: "老师照片"), InductionDate = table.Column(type: "datetime", nullable: false, comment: "入职日期"), TeacherPhoneNo = table.Column(type: "nvarchar(20)", nullable: false, comment: "老师联系方式"), Ology = table.Column(type: "nvarchar(20)", nullable: true, comment: "老师学科"), Remarks = table.Column(type: "text", nullable: true, comment: "备注"), AccumulatedTeachingTimes = table.Column(type: "int", nullable: true, comment: "授课次数"), AppletPwd = table.Column(type: "nvarchar(100)", nullable: false, comment: "小程序密码"), Creator = table.Column(type: "int)", nullable: true, comment: "创建人"), CreateDate = table.Column(type: "datetime", nullable: true, comment: "创建时间"), Modifier = table.Column(type: "int)", nullable: true, comment: "修改人"), ModifyDate = table.Column(type: "datetime", nullable: true, comment: "修改时间") }, constraints: table => { table.PrimaryKey("PK_S_Teacher", x => x.Id); }); migrationBuilder.CreateTable( name: "Sys_User", columns: table => new { User_Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), UserName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), Gender = table.Column(type: "int", nullable: false), HeadImageUrl = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: false), Dept_Id = table.Column(type: "int", nullable: true), DeptName = table.Column(type: "nvarchar(150)", maxLength: 150, nullable: false), Role_Id = table.Column(type: "int", nullable: false), RoleName = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), Token = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: false), AppType = table.Column(type: "int", nullable: true), UserTrueName = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false), SchoolCode = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false), SchoolName = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false), UserPwd = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), CreateDate = table.Column(type: "datetime", nullable: true), PhoneNo = table.Column(type: "nvarchar(11)", maxLength: 11, nullable: false), CreateID = table.Column(type: "int", nullable: true), Creator = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), Enable = table.Column(type: "int", nullable: false), ModifyID = table.Column(type: "int", nullable: true), Modifier = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), ModifyDate = table.Column(type: "datetime", nullable: true), AuditDate = table.Column(type: "datetime", nullable: true), LastLoginDate = table.Column(type: "datetime", nullable: true), LastModifyPwdDate = table.Column(type: "datetime", nullable: true), Address = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), Email = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), Remark = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false) }, constraints: table => { table.PrimaryKey("PK_Sys_User", x => x.User_Id); }); migrationBuilder.CreateTable( name: "S_HomeWorkStudents", columns: table => new { Id = table.Column(type: "int", nullable: false, comment: "Id") .Annotation("SqlServer:Identity", "1, 1"), SchoolCode = table.Column(type: "nvarchar(100)", nullable: false, comment: "学校编号"), StudentNo = table.Column(type: "nvarchar(100)", nullable: false, comment: "学生学号"), StudentName = table.Column(type: "nvarchar(100)", nullable: false, comment: "学生名称"), Sex = table.Column(type: "int", nullable: false, comment: "性别"), Photo = table.Column(type: "nvarchar(2000)", nullable: false, comment: "学生照片"), WorkStatus = table.Column(type: "int", nullable: false, comment: "学生作业状态"), HomeWorkId = table.Column(type: "int", nullable: false) }, 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); }); migrationBuilder.CreateIndex( name: "IX_S_HomeWorkStudents_HomeWorkId", table: "S_HomeWorkStudents", column: "HomeWorkId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "S_Class"); migrationBuilder.DropTable( name: "S_ClassAssocTeacher"); migrationBuilder.DropTable( name: "S_HomeWorkStudents"); migrationBuilder.DropTable( name: "S_Student"); migrationBuilder.DropTable( name: "S_SubmittedAssignments"); migrationBuilder.DropTable( name: "S_Teacher"); migrationBuilder.DropTable( name: "Sys_User"); migrationBuilder.DropTable( name: "S_HomeWork"); } } }