YD_SmartSports.Api/VOL.Core/Migrations/20240911050542_init055.cs

302 lines
12 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 init055 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "ParticipantType",
table: "G_Activities",
type: "int",
nullable: false,
defaultValue: 0,
comment: "参赛人员类型");
migrationBuilder.DropForeignKey(
name: "FK_I_TrainingStudentData_I_TrainingData_TrainingDataId",
table: "I_TrainingStudentData");
migrationBuilder.DropColumn(
name: "CreateDate",
table: "N_SportsTestCategory");
migrationBuilder.DropColumn(
name: "Creator",
table: "N_SportsTestCategory");
migrationBuilder.DropColumn(
name: "Modifier",
table: "N_SportsTestCategory");
migrationBuilder.DropColumn(
name: "ModifyDate",
table: "N_SportsTestCategory");
migrationBuilder.DropColumn(
name: "CreateDate",
table: "Ai_DeviceAssocSchool");
migrationBuilder.DropColumn(
name: "Creator",
table: "Ai_DeviceAssocSchool");
migrationBuilder.DropColumn(
name: "Modifier",
table: "Ai_DeviceAssocSchool");
migrationBuilder.DropColumn(
name: "ModifyDate",
table: "Ai_DeviceAssocSchool");
migrationBuilder.AlterColumn<DateTime>(
name: "ScoreTime",
table: "N_SportsTestValue",
type: "datetime",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
comment: "测试时间",
oldClrType: typeof(DateTime),
oldType: "datetime",
oldNullable: true,
oldComment: "测试时间");
migrationBuilder.AddColumn<string>(
name: "Remarks",
table: "N_SportsTestCategory",
type: "text",
nullable: true,
comment: "备注");
migrationBuilder.AlterColumn<int>(
name: "TrainingDataId",
table: "I_TrainingStudentData",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
migrationBuilder.CreateTable(
name: "Ai_Mode",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false, comment: "Id")
.Annotation("SqlServer:Identity", "1, 1"),
ModeName = table.Column<string>(type: "nvarchar(200)", nullable: true, comment: "AI模式名称"),
ModeEnum = table.Column<int>(type: "int", nullable: false, comment: "模式枚举"),
Remarks = table.Column<string>(type: "text", nullable: true, comment: "备注")
},
constraints: table =>
{
table.PrimaryKey("PK_Ai_Mode", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Ai_ModeAssocModule",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false, comment: "Id")
.Annotation("SqlServer:Identity", "1, 1"),
ModeId = table.Column<int>(type: "int", nullable: false, comment: "模式Id"),
TrainingModuleId = table.Column<int>(type: "int", nullable: false, comment: "模块Id")
},
constraints: table =>
{
table.PrimaryKey("PK_Ai_ModeAssocModule", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Ai_TrainingModule",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false, comment: "Id")
.Annotation("SqlServer:Identity", "1, 1"),
ModuleName = table.Column<string>(type: "nvarchar(200)", nullable: true, comment: "模块名称"),
TrainingModuleEnum = table.Column<int>(type: "int", nullable: false, comment: "训练模块枚举"),
Remarks = table.Column<string>(type: "text", nullable: true, comment: "备注")
},
constraints: table =>
{
table.PrimaryKey("PK_Ai_TrainingModule", x => x.Id);
});
migrationBuilder.CreateTable(
name: "N_SportsTrainingCategory",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false, comment: "Id")
.Annotation("SqlServer:Identity", "1, 1"),
CategoryName = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "类别中文名称"),
CategoryEnum = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "类别枚举名称"),
CategoryValue = table.Column<int>(type: "int", nullable: false, comment: "类别枚举值"),
Remarks = table.Column<string>(type: "text", nullable: true, comment: "备注")
},
constraints: table =>
{
table.PrimaryKey("PK_N_SportsTrainingCategory", x => x.Id);
});
migrationBuilder.CreateTable(
name: "N_TestAssocCategory",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false, comment: "Id")
.Annotation("SqlServer:Identity", "1, 1"),
ModeId = table.Column<int>(type: "int", nullable: false, comment: "模式Id"),
DataSource = table.Column<int>(type: "int", nullable: false, comment: "数据来源[1:IOT/2:AI]"),
CategoryValue = table.Column<int>(type: "int", nullable: false, comment: "类别枚举值")
},
constraints: table =>
{
table.PrimaryKey("PK_N_TestAssocCategory", x => x.Id);
});
migrationBuilder.CreateTable(
name: "N_TrainingAssocCategory",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false, comment: "Id")
.Annotation("SqlServer:Identity", "1, 1"),
ModeId = table.Column<int>(type: "int", nullable: false, comment: "模式Id"),
DataSource = table.Column<int>(type: "int", nullable: false, comment: "数据来源[1:IOT/2:AI]"),
CategoryValue = table.Column<int>(type: "int", nullable: false, comment: "类别枚举值")
},
constraints: table =>
{
table.PrimaryKey("PK_N_TrainingAssocCategory", x => x.Id);
});
migrationBuilder.AddForeignKey(
name: "FK_I_TrainingStudentData_I_TrainingData_TrainingDataId",
table: "I_TrainingStudentData",
column: "TrainingDataId",
principalTable: "I_TrainingData",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ParticipantType",
table: "G_Activities");
migrationBuilder.DropForeignKey(
name: "FK_I_TrainingStudentData_I_TrainingData_TrainingDataId",
table: "I_TrainingStudentData");
migrationBuilder.DropTable(
name: "Ai_Mode");
migrationBuilder.DropTable(
name: "Ai_ModeAssocModule");
migrationBuilder.DropTable(
name: "Ai_TrainingModule");
migrationBuilder.DropTable(
name: "N_SportsTrainingCategory");
migrationBuilder.DropTable(
name: "N_TestAssocCategory");
migrationBuilder.DropTable(
name: "N_TrainingAssocCategory");
migrationBuilder.DropColumn(
name: "Remarks",
table: "N_SportsTestCategory");
migrationBuilder.AlterColumn<DateTime>(
name: "ScoreTime",
table: "N_SportsTestValue",
type: "datetime",
nullable: true,
comment: "测试时间",
oldClrType: typeof(DateTime),
oldType: "datetime",
oldComment: "测试时间");
migrationBuilder.AddColumn<DateTime>(
name: "CreateDate",
table: "N_SportsTestCategory",
type: "datetime",
nullable: true,
comment: "创建时间");
migrationBuilder.AddColumn<int>(
name: "Creator",
table: "N_SportsTestCategory",
type: "int)",
nullable: false,
defaultValue: 0,
comment: "创建人");
migrationBuilder.AddColumn<int>(
name: "Modifier",
table: "N_SportsTestCategory",
type: "int)",
nullable: false,
defaultValue: 0,
comment: "修改人");
migrationBuilder.AddColumn<DateTime>(
name: "ModifyDate",
table: "N_SportsTestCategory",
type: "datetime",
nullable: true,
comment: "修改时间");
migrationBuilder.AlterColumn<int>(
name: "TrainingDataId",
table: "I_TrainingStudentData",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AddColumn<DateTime>(
name: "CreateDate",
table: "Ai_DeviceAssocSchool",
type: "datetime",
nullable: true,
comment: "创建时间");
migrationBuilder.AddColumn<int>(
name: "Creator",
table: "Ai_DeviceAssocSchool",
type: "int)",
nullable: false,
defaultValue: 0,
comment: "创建人");
migrationBuilder.AddColumn<int>(
name: "Modifier",
table: "Ai_DeviceAssocSchool",
type: "int)",
nullable: false,
defaultValue: 0,
comment: "修改人");
migrationBuilder.AddColumn<DateTime>(
name: "ModifyDate",
table: "Ai_DeviceAssocSchool",
type: "datetime",
nullable: true,
comment: "修改时间");
migrationBuilder.AddForeignKey(
name: "FK_I_TrainingStudentData_I_TrainingData_TrainingDataId",
table: "I_TrainingStudentData",
column: "TrainingDataId",
principalTable: "I_TrainingData",
principalColumn: "Id");
}
}
}