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( 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(type: "int", nullable: false, comment: "Id") .Annotation("SqlServer:Identity", "1, 1"), SchoolCode = table.Column(type: "nvarchar(100)", nullable: true, comment: "学校Code"), Code = table.Column(type: "nvarchar(100)", nullable: true, comment: "AI设备的唯一编码"), ClassRoomRecordId = table.Column(type: "int", nullable: false, comment: "课堂记录Id"), GradeId = table.Column(type: "int", nullable: false, comment: "年级编号"), ClassId = table.Column(type: "int", nullable: false, comment: "班级Id"), GradeName = table.Column(type: "nvarchar(100)", nullable: true, comment: "年级名称"), ClassName = table.Column(type: "nvarchar(100)", nullable: true, comment: "班级名称"), TeacherId = table.Column(type: "int", nullable: false, comment: "老师Id"), StudentNo = table.Column(type: "nvarchar(100)", nullable: true, comment: "学号"), StudentName = table.Column(type: "nvarchar(100)", nullable: true, comment: "姓名"), Sex = table.Column(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( name: "HomeWorkId", table: "S_HomeWorkStudents", type: "int", nullable: true, oldClrType: typeof(int), oldType: "int"); migrationBuilder.AddColumn( name: "ClassId", table: "Ai_ClassRoomRecord", type: "int", nullable: false, defaultValue: 0, comment: "班级Id"); migrationBuilder.AddColumn( name: "ClassName", table: "Ai_ClassRoomRecord", type: "nvarchar(100)", nullable: true, comment: "班级名称"); migrationBuilder.AddColumn( name: "GradeId", table: "Ai_ClassRoomRecord", type: "int", nullable: false, defaultValue: 0, comment: "年级编号"); migrationBuilder.AddColumn( 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"); } } }