YD_SmartSports.Api/VOL.Core/Migrations/20240917014906_init064.cs

515 lines
29 KiB
C#
Raw Normal View History

2025-06-06 16:00:39 +08:00
using Microsoft.EntityFrameworkCore.Migrations;
using System;
#nullable disable
namespace VOL.Core.Migrations
{
public partial class init064 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Ai_Result");
migrationBuilder.DropTable(
name: "Ai_TrainingDetailsData");
migrationBuilder.DropColumn(
name: "StudentCount",
table: "Ai_TrainingData");
migrationBuilder.DropColumn(
name: "TotalNumber",
table: "Ai_TrainingData");
migrationBuilder.AddColumn<double>(
name: "AdditionalScore",
table: "Ai_TrainingData",
type: "float",
nullable: false,
defaultValue: 0.0,
comment: "附加分");
migrationBuilder.AddColumn<int>(
name: "Consumption",
table: "Ai_TrainingData",
type: "int",
nullable: false,
defaultValue: 0,
comment: "运动消耗");
migrationBuilder.AddColumn<string>(
name: "CorrectJudge",
table: "Ai_TrainingData",
type: "nvarchar(4000)",
nullable: true,
comment: "动作解析");
migrationBuilder.AddColumn<int>(
name: "CorrectNumber",
table: "Ai_TrainingData",
type: "int",
nullable: true,
comment: "正确个数");
migrationBuilder.AddColumn<int>(
name: "Duration",
table: "Ai_TrainingData",
type: "int",
nullable: false,
defaultValue: 0,
comment: "持续时间");
migrationBuilder.AddColumn<int>(
name: "ErrorNumber",
table: "Ai_TrainingData",
type: "int",
nullable: true,
comment: "错误个数");
migrationBuilder.AddColumn<int>(
name: "MaxValue",
table: "Ai_TrainingData",
type: "int",
nullable: true,
comment: "最大");
migrationBuilder.AddColumn<int>(
name: "MinValue",
table: "Ai_TrainingData",
type: "int",
nullable: true,
comment: "最小");
migrationBuilder.AddColumn<int>(
name: "MotionDuration",
table: "Ai_TrainingData",
type: "int",
nullable: false,
defaultValue: 0,
comment: "运动时长/分钟");
migrationBuilder.AddColumn<int>(
name: "Rank",
table: "Ai_TrainingData",
type: "int",
nullable: false,
defaultValue: 0,
comment: "训练成绩等级");
migrationBuilder.AddColumn<string>(
name: "RankStr",
table: "Ai_TrainingData",
type: "nvarchar(100)",
nullable: true,
comment: "等级");
migrationBuilder.AddColumn<string>(
name: "Remark",
table: "Ai_TrainingData",
type: "nvarchar(4000)",
nullable: true,
comment: "设备评价语");
migrationBuilder.AddColumn<double>(
name: "Score",
table: "Ai_TrainingData",
type: "float",
nullable: false,
defaultValue: 0.0,
comment: "得分");
migrationBuilder.AddColumn<int>(
name: "Sex",
table: "Ai_TrainingData",
type: "int",
nullable: false,
defaultValue: 0,
comment: "学校Co性别de");
migrationBuilder.AddColumn<int>(
name: "Strength",
table: "Ai_TrainingData",
type: "int",
nullable: false,
defaultValue: 0,
comment: "运动强度");
migrationBuilder.AddColumn<string>(
name: "StudentName",
table: "Ai_TrainingData",
type: "nvarchar(100)",
nullable: true,
comment: "姓名");
migrationBuilder.AddColumn<string>(
name: "StudentNo",
table: "Ai_TrainingData",
type: "nvarchar(100)",
nullable: true,
comment: "学号");
migrationBuilder.AddColumn<long>(
name: "UniqueId",
table: "Ai_TrainingData",
type: "bigint",
nullable: false,
defaultValue: 0L,
comment: "设备上传成绩时唯一标识, 重复时服务端不保存数据");
migrationBuilder.AddColumn<double>(
name: "Value",
table: "Ai_TrainingData",
type: "float",
nullable: false,
defaultValue: 0.0,
comment: "测试成绩");
migrationBuilder.AddColumn<double>(
name: "WrongResults",
table: "Ai_TrainingData",
type: "float",
nullable: true,
comment: "错误成绩");
migrationBuilder.CreateTable(
name: "Ai_ActivitiestData",
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: true, comment: "学校Code"),
Code = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "AI设备的唯一编码"),
ActivitiesId = table.Column<int>(type: "int", nullable: false, comment: "活动Id"),
UniqueId = table.Column<long>(type: "bigint", nullable: false, comment: "设备上传成绩时唯一标识, 重复时服务端不保存数据"),
GradeId = table.Column<int>(type: "int", nullable: false, comment: "年级编号"),
ClassId = table.Column<int>(type: "int", nullable: false, comment: "班级Id"),
GradeName = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "年级名称"),
ClassName = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "班级名称"),
StudentCount = table.Column<int>(type: "int", nullable: false, comment: "班级人数"),
TeacherId = table.Column<int>(type: "int", nullable: false, comment: "老师Id"),
TeacherPhone = table.Column<string>(type: "varchar(11)", nullable: true, comment: "老师手机号"),
ModeType = table.Column<int>(type: "int", nullable: false, comment: "模式类型"),
ModelName = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "模式名称"),
TrainingModule = table.Column<int>(type: "int", nullable: false, comment: "训练模块"),
CategoryValue = table.Column<int>(type: "int", nullable: false, comment: "项目类型"),
StartTime = table.Column<DateTime>(type: "datetime", nullable: true, comment: "开始时间"),
EndTime = table.Column<DateTime>(type: "datetime", nullable: true, comment: "结束时间"),
TotalNumber = table.Column<int>(type: "int", nullable: false, comment: "参与人数"),
TotalRound = table.Column<int>(type: "int", nullable: true, comment: "总轮次"),
LimitTime = table.Column<int>(type: "int", nullable: false, comment: "限时"),
LimitNumber = table.Column<int>(type: "int", nullable: false, comment: "限数"),
TrainingType = table.Column<int>(type: "int", nullable: true, comment: "标准赛类型"),
TrainingTime = table.Column<int>(type: "int", nullable: true, comment: "训练倒计时时间 (1, 2 分钟)"),
TotalTime = table.Column<int>(type: "int", nullable: true, comment: "限时限数总耗时"),
StudentNo = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "学号"),
StudentName = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "姓名"),
Sex = table.Column<int>(type: "int", nullable: false, comment: "学校Co性别de"),
Value = table.Column<double>(type: "float", nullable: false, comment: "测试成绩"),
MotionDuration = table.Column<int>(type: "int", nullable: false, comment: "运动时长/分钟"),
Consumption = table.Column<int>(type: "int", nullable: false, comment: "运动消耗"),
Strength = table.Column<int>(type: "int", nullable: false, comment: "运动强度"),
Score = table.Column<double>(type: "float", nullable: false, comment: "得分"),
AdditionalScore = table.Column<double>(type: "float", nullable: false, comment: "附加分"),
Height = table.Column<double>(type: "float", nullable: true, comment: "身高"),
Weight = table.Column<double>(type: "float", nullable: true, comment: "体重"),
Rank = table.Column<int>(type: "int", nullable: false, comment: "训练成绩等级"),
RankStr = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "等级"),
ErrorNumber = table.Column<int>(type: "int", nullable: true, comment: "错误个数"),
CorrectNumber = table.Column<int>(type: "int", nullable: true, comment: "正确个数"),
MaxValue = table.Column<int>(type: "int", nullable: true, comment: "最大"),
MinValue = table.Column<int>(type: "int", nullable: true, comment: "最小"),
Remark = table.Column<string>(type: "nvarchar(4000)", nullable: true, comment: "设备评价语"),
Duration = table.Column<int>(type: "int", nullable: false, comment: "持续时间"),
WrongResults = table.Column<double>(type: "float", nullable: true, comment: "错误成绩"),
CorrectJudge = table.Column<string>(type: "nvarchar(4000)", nullable: true, comment: "动作解析")
},
constraints: table =>
{
table.PrimaryKey("PK_Ai_ActivitiestData", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Ai_LevelExamData",
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: true, comment: "学校Code"),
Code = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "AI设备的唯一编码"),
UniqueId = table.Column<long>(type: "bigint", nullable: false, comment: "设备上传成绩时唯一标识, 重复时服务端不保存数据"),
GradeId = table.Column<int>(type: "int", nullable: false, comment: "年级编号"),
ClassId = table.Column<int>(type: "int", nullable: false, comment: "班级Id"),
GradeName = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "年级名称"),
ClassName = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "班级名称"),
TeacherId = table.Column<int>(type: "int", nullable: false, comment: "老师Id"),
TeacherPhone = table.Column<string>(type: "varchar(11)", nullable: true, comment: "老师手机号"),
SpecialId = table.Column<int>(type: "int", nullable: false, comment: "专项类型Id"),
StartTime = table.Column<DateTime>(type: "datetime", nullable: true, comment: "开始时间"),
EndTime = table.Column<DateTime>(type: "datetime", nullable: true, comment: "结束时间"),
StudentNo = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "学号"),
StudentName = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "姓名"),
Sex = table.Column<int>(type: "int", nullable: false, comment: "学校Co性别de"),
Value = table.Column<double>(type: "float", nullable: false, comment: "测试成绩"),
Score = table.Column<double>(type: "float", nullable: false, comment: "得分"),
AssessmentResults = table.Column<int>(type: "int", nullable: false, comment: "是否通过"),
MotionDuration = table.Column<int>(type: "int", nullable: false, comment: "运动时长/分钟"),
Consumption = table.Column<int>(type: "int", nullable: false, comment: "运动消耗"),
Strength = table.Column<int>(type: "int", nullable: false, comment: "运动强度"),
Rank = table.Column<int>(type: "int", nullable: false, comment: "专项测评等级"),
RankStr = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "专项测评等级"),
ErrorNumber = table.Column<int>(type: "int", nullable: true, comment: "错误个数"),
CorrectNumber = table.Column<int>(type: "int", nullable: true, comment: "正确个数"),
MaxValue = table.Column<int>(type: "int", nullable: true, comment: "最大"),
MinValue = table.Column<int>(type: "int", nullable: true, comment: "最小"),
Remark = table.Column<string>(type: "nvarchar(4000)", nullable: true, comment: "设备评价语"),
Duration = table.Column<int>(type: "int", nullable: false, comment: "持续时间"),
WrongResults = table.Column<double>(type: "float", nullable: true, comment: "错误成绩"),
CorrectJudge = table.Column<string>(type: "nvarchar(4000)", nullable: true, comment: "动作解析")
},
constraints: table =>
{
table.PrimaryKey("PK_Ai_LevelExamData", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Ai_SportsTestData",
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: true, comment: "学校Code"),
Code = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "AI设备的唯一编码"),
UniqueId = table.Column<long>(type: "bigint", nullable: false, comment: "设备上传成绩时唯一标识, 重复时服务端不保存数据"),
GradeId = table.Column<int>(type: "int", nullable: false, comment: "年级编号"),
ClassId = table.Column<int>(type: "int", nullable: false, comment: "班级Id"),
GradeName = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "年级名称"),
ClassName = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "班级名称"),
StudentCount = table.Column<int>(type: "int", nullable: false, comment: "班级人数"),
TeacherId = table.Column<int>(type: "int", nullable: false, comment: "老师Id"),
TeacherPhone = table.Column<string>(type: "varchar(11)", nullable: true, comment: "老师手机号"),
ModeType = table.Column<int>(type: "int", nullable: false, comment: "模式类型"),
ModelName = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "模式名称"),
TrainingModule = table.Column<int>(type: "int", nullable: false, comment: "训练模块"),
CategoryValue = table.Column<int>(type: "int", nullable: false, comment: "项目类型"),
StartTime = table.Column<DateTime>(type: "datetime", nullable: true, comment: "开始时间"),
EndTime = table.Column<DateTime>(type: "datetime", nullable: true, comment: "结束时间"),
TotalNumber = table.Column<int>(type: "int", nullable: false, comment: "参与人数"),
TotalRound = table.Column<int>(type: "int", nullable: true, comment: "总轮次"),
LimitTime = table.Column<int>(type: "int", nullable: false, comment: "限时"),
LimitNumber = table.Column<int>(type: "int", nullable: false, comment: "限数"),
TrainingType = table.Column<int>(type: "int", nullable: true, comment: "标准赛类型"),
TrainingTime = table.Column<int>(type: "int", nullable: true, comment: "训练倒计时时间 (1, 2 分钟)"),
TotalTime = table.Column<int>(type: "int", nullable: true, comment: "限时限数总耗时"),
StudentNo = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "学号"),
StudentName = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "姓名"),
Sex = table.Column<int>(type: "int", nullable: false, comment: "学校Co性别de"),
Value = table.Column<double>(type: "float", nullable: false, comment: "测试成绩"),
MotionDuration = table.Column<int>(type: "int", nullable: false, comment: "运动时长/分钟"),
Consumption = table.Column<int>(type: "int", nullable: false, comment: "运动消耗"),
Strength = table.Column<int>(type: "int", nullable: false, comment: "运动强度"),
Score = table.Column<double>(type: "float", nullable: false, comment: "得分"),
AdditionalScore = table.Column<double>(type: "float", nullable: false, comment: "附加分"),
Height = table.Column<double>(type: "float", nullable: true, comment: "身高"),
Weight = table.Column<double>(type: "float", nullable: true, comment: "体重"),
Rank = table.Column<int>(type: "int", nullable: false, comment: "训练成绩等级"),
RankStr = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "等级"),
ErrorNumber = table.Column<int>(type: "int", nullable: true, comment: "错误个数"),
CorrectNumber = table.Column<int>(type: "int", nullable: true, comment: "正确个数"),
MaxValue = table.Column<int>(type: "int", nullable: true, comment: "最大"),
MinValue = table.Column<int>(type: "int", nullable: true, comment: "最小"),
Remark = table.Column<string>(type: "nvarchar(4000)", nullable: true, comment: "设备评价语"),
Duration = table.Column<int>(type: "int", nullable: false, comment: "持续时间"),
WrongResults = table.Column<double>(type: "float", nullable: true, comment: "错误成绩"),
CorrectJudge = table.Column<string>(type: "nvarchar(4000)", nullable: true, comment: "动作解析")
},
constraints: table =>
{
table.PrimaryKey("PK_Ai_SportsTestData", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Ai_ActivitiestData");
migrationBuilder.DropTable(
name: "Ai_LevelExamData");
migrationBuilder.DropTable(
name: "Ai_SportsTestData");
migrationBuilder.DropColumn(
name: "AdditionalScore",
table: "Ai_TrainingData");
migrationBuilder.DropColumn(
name: "Consumption",
table: "Ai_TrainingData");
migrationBuilder.DropColumn(
name: "CorrectJudge",
table: "Ai_TrainingData");
migrationBuilder.DropColumn(
name: "CorrectNumber",
table: "Ai_TrainingData");
migrationBuilder.DropColumn(
name: "Duration",
table: "Ai_TrainingData");
migrationBuilder.DropColumn(
name: "ErrorNumber",
table: "Ai_TrainingData");
migrationBuilder.DropColumn(
name: "MaxValue",
table: "Ai_TrainingData");
migrationBuilder.DropColumn(
name: "MinValue",
table: "Ai_TrainingData");
migrationBuilder.DropColumn(
name: "MotionDuration",
table: "Ai_TrainingData");
migrationBuilder.DropColumn(
name: "Rank",
table: "Ai_TrainingData");
migrationBuilder.DropColumn(
name: "RankStr",
table: "Ai_TrainingData");
migrationBuilder.DropColumn(
name: "Remark",
table: "Ai_TrainingData");
migrationBuilder.DropColumn(
name: "Score",
table: "Ai_TrainingData");
migrationBuilder.DropColumn(
name: "Sex",
table: "Ai_TrainingData");
migrationBuilder.DropColumn(
name: "Strength",
table: "Ai_TrainingData");
migrationBuilder.DropColumn(
name: "StudentName",
table: "Ai_TrainingData");
migrationBuilder.DropColumn(
name: "StudentNo",
table: "Ai_TrainingData");
migrationBuilder.DropColumn(
name: "UniqueId",
table: "Ai_TrainingData");
migrationBuilder.DropColumn(
name: "Value",
table: "Ai_TrainingData");
migrationBuilder.DropColumn(
name: "WrongResults",
table: "Ai_TrainingData");
migrationBuilder.AddColumn<int>(
name: "StudentCount",
table: "Ai_TrainingData",
type: "int",
nullable: false,
defaultValue: 0,
comment: "班级人数");
migrationBuilder.AddColumn<int>(
name: "TotalNumber",
table: "Ai_TrainingData",
type: "int",
nullable: false,
defaultValue: 0,
comment: "参与人数");
migrationBuilder.CreateTable(
name: "Ai_Result",
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"),
ClassName = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "班级名称"),
Code = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "AI设备的唯一编码"),
CorrectJudge = table.Column<string>(type: "nvarchar(4000)", nullable: true, comment: "动作解析"),
Duration = table.Column<int>(type: "int", nullable: false, comment: "持续时间"),
Gender = table.Column<int>(type: "int", nullable: false, comment: "性别"),
GradeId = table.Column<int>(type: "int", nullable: false, comment: "年级Id"),
GradeName = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "年级名称"),
Height = table.Column<double>(type: "float", nullable: true, comment: "身高"),
ItemCode = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "测试项目编码"),
Remark = table.Column<string>(type: "nvarchar(4000)", nullable: true, comment: "设备评价语"),
SchoolCode = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "学校Code"),
SchoolName = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "学校名称"),
StudentName = table.Column<string>(type: "nvarchar(1000)", nullable: true, comment: "学生姓名"),
StudentNo = table.Column<string>(type: "nvarchar(1000)", nullable: true, comment: "测试的学生全国学籍号"),
TeacherId = table.Column<int>(type: "int", nullable: true, comment: "老师Id"),
TeacherName = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "老师姓名"),
TestResult = table.Column<double>(type: "float", nullable: false, comment: "成绩"),
TestTime = table.Column<DateTime>(type: "datetime", nullable: true, comment: "学生实际测试结束的时间"),
UniqueId = table.Column<long>(type: "bigint", nullable: false, comment: "设备上传成绩时唯一标识, 重复时服务端不保存数据"),
Weight = table.Column<double>(type: "float", nullable: true, comment: "体重"),
WrongResults = table.Column<double>(type: "float", nullable: true, comment: "错误成绩")
},
constraints: table =>
{
table.PrimaryKey("PK_Ai_Result", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Ai_TrainingDetailsData",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false, comment: "Id")
.Annotation("SqlServer:Identity", "1, 1"),
TrainingDataId = table.Column<int>(type: "int", nullable: false, comment: "训练数据Id"),
AdditionalScore = table.Column<double>(type: "float", nullable: false, comment: "附加分"),
Consumption = table.Column<int>(type: "int", nullable: false, comment: "运动消耗"),
CorrectNumber = table.Column<int>(type: "int", nullable: true, comment: "正确个数"),
ErrorNumber = table.Column<int>(type: "int", nullable: true, comment: "错误个数"),
EvaluationGrade = table.Column<int>(type: "int", nullable: false, comment: "测评等级"),
MaxValue = table.Column<int>(type: "int", nullable: true, comment: "最大"),
MinValue = table.Column<int>(type: "int", nullable: true, comment: "最小"),
MotionDuration = table.Column<int>(type: "int", nullable: false, comment: "运动时长/分钟"),
Rank = table.Column<int>(type: "int", nullable: false, comment: "训练成绩等级"),
RankStr = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "等级"),
Score = table.Column<double>(type: "float", nullable: false, comment: "得分"),
Sex = table.Column<int>(type: "int", nullable: false, comment: "学校Co性别de"),
Strength = table.Column<int>(type: "int", nullable: false, comment: "运动强度"),
StudentName = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "姓名"),
StudentNo = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "学号"),
Value = table.Column<double>(type: "float", nullable: false, comment: "测试成绩")
},
constraints: table =>
{
table.PrimaryKey("PK_Ai_TrainingDetailsData", x => x.Id);
table.ForeignKey(
name: "FK_Ai_TrainingDetailsData_Ai_TrainingData_TrainingDataId",
column: x => x.TrainingDataId,
principalTable: "Ai_TrainingData",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Ai_TrainingDetailsData_TrainingDataId",
table: "Ai_TrainingDetailsData",
column: "TrainingDataId");
}
}
}