136 lines
8.6 KiB
C#
136 lines
8.6 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace YD_WeChatApplet.Api.Migrations
|
|
{
|
|
public partial class _20250310v1 : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
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: "作业类型名称"),
|
|
WorkModeType = table.Column<int>(type: "int", nullable: false, comment: "作业类型"),
|
|
WorkModeTypeName = 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: "结束时间"),
|
|
CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, comment: "创建时间")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_S_HomeWork", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "WCA_ExerciseData",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false, comment: "Id")
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
RoleId = table.Column<int>(type: "int", nullable: false, comment: "角色"),
|
|
UserId = table.Column<int>(type: "int", nullable: false, comment: "用户Id"),
|
|
UserName = table.Column<string>(type: "nvarchar(200)", 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: "性别"),
|
|
Age = table.Column<int>(type: "int", nullable: true, comment: "年龄"),
|
|
Photo = table.Column<string>(type: "nvarchar(2000)", nullable: false, comment: "学生照片"),
|
|
WorkType = table.Column<int>(type: "int", nullable: false, comment: "作业类型"),
|
|
WorkTypeName = table.Column<string>(type: "nvarchar(200)", nullable: false, comment: "作业类型名称"),
|
|
WorkModeType = table.Column<int>(type: "int", nullable: false, comment: "作业类型"),
|
|
WorkModeTypeName = 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: "数量"),
|
|
Calorie = table.Column<int>(type: "int", nullable: false, comment: "卡路里"),
|
|
WorkStatus = table.Column<int>(type: "int", nullable: false, comment: "状态"),
|
|
StartTime = table.Column<DateTime>(type: "datetime", nullable: false, comment: "开始时间"),
|
|
EndTime = table.Column<DateTime>(type: "datetime", nullable: false, comment: "结束时间"),
|
|
CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, comment: "创建时间")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_WCA_ExerciseData", 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"),
|
|
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: "性别"),
|
|
Age = table.Column<int>(type: "int", nullable: true, comment: "年龄"),
|
|
Photo = table.Column<string>(type: "nvarchar(2000)", nullable: false, comment: "学生照片"),
|
|
Value = table.Column<int>(type: "int", nullable: false, comment: "成绩"),
|
|
WorkStatus = table.Column<int>(type: "int", nullable: false, comment: "学生作业状态"),
|
|
HomeWorkId = table.Column<int>(type: "int", nullable: false),
|
|
WCA_ExerciseDataId = table.Column<int>(type: "int", nullable: true)
|
|
},
|
|
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");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "S_HomeWorkStudents");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "S_HomeWork");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "WCA_ExerciseData");
|
|
}
|
|
}
|
|
}
|