2025-06-06 14:57:20 +08:00

274 lines
19 KiB
C#

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<int>(type: "int", nullable: false, comment: "Id")
.Annotation("SqlServer:Identity", "1, 1"),
SchoolCode = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "学校编号"),
GradeId = table.Column<int>(type: "int", nullable: false, comment: "年级Id"),
GradeName = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "年级名称"),
ClassName = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "班级名称"),
Remarks = table.Column<string>(type: "text", nullable: true, comment: "备注"),
Creator = table.Column<int>(type: "int)", nullable: true, comment: "创建人"),
CreateDate = table.Column<DateTime>(type: "datetime", nullable: true, comment: "创建时间"),
Modifier = table.Column<int>(type: "int)", nullable: true, comment: "修改人"),
ModifyDate = table.Column<DateTime>(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<int>(type: "int", nullable: false, comment: "Id")
.Annotation("SqlServer:Identity", "1, 1"),
ClassId = table.Column<int>(type: "int", nullable: false, comment: "班级Id"),
TeacherId = table.Column<int>(type: "int", nullable: false, comment: "老师Id"),
Creator = table.Column<int>(type: "int)", nullable: false, comment: "创建人"),
CreateDate = table.Column<DateTime>(type: "datetime", nullable: true, comment: "创建时间"),
Modifier = table.Column<int>(type: "int)", nullable: false, comment: "修改人"),
ModifyDate = table.Column<DateTime>(type: "datetime", nullable: true, comment: "修改时间"),
Remarks = table.Column<string>(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<int>(type: "int", nullable: false, comment: "Id")
.Annotation("SqlServer:Identity", "1, 1"),
SchoolCode = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "学校编号"),
WorkName = table.Column<string>(type: "nvarchar(200)", 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: "作业类型名称"),
Duration = table.Column<int>(type: "int", nullable: false, comment: "作业时长"),
Amount = table.Column<int>(type: "int", 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: "重复周期"),
WorkStatus = table.Column<int>(type: "int", 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: "老师手机号"),
GradeId = table.Column<int>(type: "int", nullable: false, comment: "年级Id"),
GradeName = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "年级名称"),
ClassId = table.Column<int>(type: "int", nullable: false, comment: "班级Id"),
ClassName = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "班级名称"),
StartTime = table.Column<DateTime>(type: "datetime", nullable: false, comment: "开始时间"),
EndTime = table.Column<DateTime>(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<int>(type: "int", nullable: false, comment: "Id")
.Annotation("SqlServer:Identity", "1, 1"),
SchoolCode = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "学校编号"),
ClassId = table.Column<int>(type: "int", nullable: false, comment: "班级Id"),
ClassName = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "班级名称"),
StudentNo = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "学生学号"),
SchoolRollNo = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "学籍号"),
PlaceSchoolRollNo = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "地方学籍号"),
HeartRateFrontNo = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "心率设备正面编号"),
HeartRateId = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "心率设备ID"),
HeartRateQRCode = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "心率设备二维码编号"),
RopeSkipQRCode = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "跳绳编号"),
RopeSkipNo = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "跳绳二维码编号"),
RunChipNo = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "中长跑芯片编号"),
TotalTrainTime = table.Column<double>(type: "float", nullable: true, comment: "训练时长"),
TotalTrainNumber = table.Column<int>(type: "int", nullable: true, comment: "训练次数"),
IDCard = table.Column<string>(type: "nvarchar(50)", nullable: true, comment: "身份证"),
StudentNation = table.Column<string>(type: "nvarchar(50)", nullable: true, comment: "学生名族"),
StudentName = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "学生名称"),
Age = table.Column<int>(type: "int", nullable: false, comment: "年龄"),
Sex = table.Column<int>(type: "int", nullable: false, comment: "性别"),
Photo = table.Column<string>(type: "nvarchar(2000)", nullable: false, comment: "学生照片"),
Nation = table.Column<string>(type: "nvarchar(20)", nullable: true, comment: "民族"),
HomeAddress = table.Column<string>(type: "nvarchar(200)", nullable: true, comment: "家庭住址"),
StudentStatus = table.Column<int>(type: "int", nullable: false, comment: "状态"),
Birthday = table.Column<DateTime>(type: "datetime", nullable: true, comment: "出生日期"),
ParentName = table.Column<string>(type: "nvarchar(20)", nullable: true, comment: "家长姓名"),
ParentPhoneNo = table.Column<string>(type: "nvarchar(20)", nullable: true, comment: "家长联系方式"),
AppletPwd = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "小程序密码"),
Remarks = table.Column<string>(type: "text", nullable: true, comment: "备注"),
Creator = table.Column<int>(type: "int)", nullable: false, comment: "创建人"),
CreateDate = table.Column<DateTime>(type: "datetime", nullable: true, comment: "创建时间"),
Modifier = table.Column<int>(type: "int)", nullable: false, comment: "修改人"),
ModifyDate = table.Column<DateTime>(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<int>(type: "int", nullable: false, comment: "Id")
.Annotation("SqlServer:Identity", "1, 1"),
SchoolCode = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "学校编号"),
HomeWorkId = table.Column<int>(type: "int", nullable: false, comment: "作业Id"),
StudentNo = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "学生学号"),
FileType = table.Column<int>(type: "int", nullable: false, comment: "文件类型"),
FileSize = table.Column<int>(type: "int", nullable: true, comment: "文件大小"),
FileName = table.Column<string>(type: "nvarchar(200)", nullable: false, comment: "文件名称"),
FilePath = table.Column<string>(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<int>(type: "int", nullable: false, comment: "Id")
.Annotation("SqlServer:Identity", "1, 1"),
SchoolCode = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "学校编号"),
TeacherName = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "教师名称"),
Age = table.Column<int>(type: "int", nullable: false, comment: "教师年龄"),
Sex = table.Column<int>(type: "int", nullable: false, comment: "教师性别"),
TeacherStatus = table.Column<int>(type: "int", nullable: false, comment: "状态"),
TeacherPhoto = table.Column<string>(type: "nvarchar(2000)", nullable: true, comment: "老师照片"),
InductionDate = table.Column<DateTime>(type: "datetime", nullable: false, comment: "入职日期"),
TeacherPhoneNo = table.Column<string>(type: "nvarchar(20)", nullable: false, comment: "老师联系方式"),
Ology = table.Column<string>(type: "nvarchar(20)", nullable: true, comment: "老师学科"),
Remarks = table.Column<string>(type: "text", nullable: true, comment: "备注"),
AccumulatedTeachingTimes = table.Column<int>(type: "int", nullable: true, comment: "授课次数"),
AppletPwd = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "小程序密码"),
Creator = table.Column<int>(type: "int)", nullable: true, comment: "创建人"),
CreateDate = table.Column<DateTime>(type: "datetime", nullable: true, comment: "创建时间"),
Modifier = table.Column<int>(type: "int)", nullable: true, comment: "修改人"),
ModifyDate = table.Column<DateTime>(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<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
UserName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
Gender = table.Column<int>(type: "int", nullable: false),
HeadImageUrl = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
Dept_Id = table.Column<int>(type: "int", nullable: true),
DeptName = table.Column<string>(type: "nvarchar(150)", maxLength: 150, nullable: false),
Role_Id = table.Column<int>(type: "int", nullable: false),
RoleName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
Token = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
AppType = table.Column<int>(type: "int", nullable: true),
UserTrueName = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false),
SchoolCode = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false),
SchoolName = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false),
UserPwd = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
CreateDate = table.Column<DateTime>(type: "datetime", nullable: true),
PhoneNo = table.Column<string>(type: "nvarchar(11)", maxLength: 11, nullable: false),
CreateID = table.Column<int>(type: "int", nullable: true),
Creator = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
Enable = table.Column<int>(type: "int", nullable: false),
ModifyID = table.Column<int>(type: "int", nullable: true),
Modifier = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
ModifyDate = table.Column<DateTime>(type: "datetime", nullable: true),
AuditDate = table.Column<DateTime>(type: "datetime", nullable: true),
LastLoginDate = table.Column<DateTime>(type: "datetime", nullable: true),
LastModifyPwdDate = table.Column<DateTime>(type: "datetime", nullable: true),
Address = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
Email = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
Remark = table.Column<string>(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<int>(type: "int", nullable: false, comment: "Id")
.Annotation("SqlServer:Identity", "1, 1"),
SchoolCode = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "学校编号"),
StudentNo = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "学生学号"),
StudentName = table.Column<string>(type: "nvarchar(100)", nullable: false, comment: "学生名称"),
Sex = table.Column<int>(type: "int", nullable: false, comment: "性别"),
Photo = table.Column<string>(type: "nvarchar(2000)", nullable: false, comment: "学生照片"),
WorkStatus = table.Column<int>(type: "int", nullable: false, comment: "学生作业状态"),
HomeWorkId = table.Column<int>(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");
}
}
}