using Microsoft.EntityFrameworkCore.Migrations; using System; #nullable disable namespace VOL.Core.Migrations { public partial class init036 : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_I_SportsTestData_I_SportsTest_SportsTestId", table: "I_SportsTestData"); migrationBuilder.DropTable( name: "I_SportsTest"); migrationBuilder.DropIndex( name: "IX_I_SportsTestData_SportsTestId", table: "I_SportsTestData"); migrationBuilder.DropColumn( name: "SportsTestId", table: "I_SportsTestData"); migrationBuilder.AlterColumn( name: "ScoreTime", table: "N_SportsTestValue", type: "datetime", nullable: true, comment: "测试时间", oldClrType: typeof(DateTime), oldType: "datetime", oldComment: "测试时间"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.AlterColumn( 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( name: "SportsTestId", table: "I_SportsTestData", type: "int", nullable: false, defaultValue: 0); migrationBuilder.CreateTable( name: "I_SportsTest", columns: table => new { Id = table.Column(type: "int", nullable: false, comment: "Id") .Annotation("SqlServer:Identity", "1, 1"), ClassId = table.Column(type: "int", nullable: false, comment: "班级Id"), ClassName = table.Column(type: "nvarchar(100)", nullable: true, comment: "班级名称"), GradeId = table.Column(type: "int", nullable: false, comment: "年级Id"), GradeName = table.Column(type: "nvarchar(100)", nullable: true, comment: "年级名称"), SchoolCode = table.Column(type: "nvarchar(100)", nullable: true, comment: "学校Code"), SchoolName = table.Column(type: "nvarchar(100)", nullable: true, comment: "学校名称"), ScoreTime = table.Column(type: "datetime", nullable: true, comment: "提交时间"), TeacherId = table.Column(type: "int", nullable: true, comment: "老师Id"), TeacherName = table.Column(type: "nvarchar(100)", nullable: true, comment: "老师姓名") }, constraints: table => { table.PrimaryKey("PK_I_SportsTest", x => x.Id); }); migrationBuilder.CreateIndex( name: "IX_I_SportsTestData_SportsTestId", table: "I_SportsTestData", column: "SportsTestId"); migrationBuilder.AddForeignKey( name: "FK_I_SportsTestData_I_SportsTest_SportsTestId", table: "I_SportsTestData", column: "SportsTestId", principalTable: "I_SportsTest", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } } }