YD_SmartSports.Api/VOL.Core/Migrations/20241011161421_init082.cs

134 lines
5.2 KiB
C#
Raw Normal View History

2025-06-06 16:00:39 +08:00
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace VOL.Core.Migrations
{
public partial class init082 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_S_HomeWorkStudents_S_HomeWork_HomeWorkId",
table: "S_HomeWorkStudents");
migrationBuilder.DropColumn(
name: "ClassId",
table: "Ai_ClassRoomRecord");
migrationBuilder.DropColumn(
name: "ClassName",
table: "Ai_ClassRoomRecord");
migrationBuilder.DropColumn(
name: "GradeId",
table: "Ai_ClassRoomRecord");
migrationBuilder.DropColumn(
name: "GradeName",
table: "Ai_ClassRoomRecord");
migrationBuilder.AlterColumn<int>(
name: "HomeWorkId",
table: "S_HomeWorkStudents",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
migrationBuilder.CreateTable(
name: "Ai_ClassroomStudentRecord",
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设备的唯一编码"),
ClassRoomRecordId = table.Column<int>(type: "int", nullable: false, comment: "课堂记录Id"),
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"),
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")
},
constraints: table =>
{
table.PrimaryKey("PK_Ai_ClassroomStudentRecord", x => x.Id);
});
migrationBuilder.AddForeignKey(
name: "FK_S_HomeWorkStudents_S_HomeWork_HomeWorkId",
table: "S_HomeWorkStudents",
column: "HomeWorkId",
principalTable: "S_HomeWork",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_S_HomeWorkStudents_S_HomeWork_HomeWorkId",
table: "S_HomeWorkStudents");
migrationBuilder.DropTable(
name: "Ai_ClassroomStudentRecord");
migrationBuilder.RenameColumn(
name: "SchoolCode",
table: "Sys_User",
newName: "SchooCode");
migrationBuilder.AlterColumn<int>(
name: "HomeWorkId",
table: "S_HomeWorkStudents",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AddColumn<int>(
name: "ClassId",
table: "Ai_ClassRoomRecord",
type: "int",
nullable: false,
defaultValue: 0,
comment: "班级Id");
migrationBuilder.AddColumn<string>(
name: "ClassName",
table: "Ai_ClassRoomRecord",
type: "nvarchar(100)",
nullable: true,
comment: "班级名称");
migrationBuilder.AddColumn<int>(
name: "GradeId",
table: "Ai_ClassRoomRecord",
type: "int",
nullable: false,
defaultValue: 0,
comment: "年级编号");
migrationBuilder.AddColumn<string>(
name: "GradeName",
table: "Ai_ClassRoomRecord",
type: "nvarchar(100)",
nullable: true,
comment: "年级名称");
migrationBuilder.AddForeignKey(
name: "FK_S_HomeWorkStudents_S_HomeWork_HomeWorkId",
table: "S_HomeWorkStudents",
column: "HomeWorkId",
principalTable: "S_HomeWork",
principalColumn: "Id");
}
}
}