YD_SmartSports.Api/VOL.Core/Migrations/20240816084535_init036.cs

94 lines
3.8 KiB
C#
Raw Permalink 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 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<DateTime>(
name: "ScoreTime",
table: "N_SportsTestValue",
type: "datetime",
nullable: true,
comment: "测试时间",
oldClrType: typeof(DateTime),
oldType: "datetime",
oldComment: "测试时间");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
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<int>(
name: "SportsTestId",
table: "I_SportsTestData",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateTable(
name: "I_SportsTest",
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: "班级名称"),
GradeId = table.Column<int>(type: "int", nullable: false, comment: "年级Id"),
GradeName = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "年级名称"),
SchoolCode = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "学校Code"),
SchoolName = table.Column<string>(type: "nvarchar(100)", nullable: true, comment: "学校名称"),
ScoreTime = table.Column<DateTime>(type: "datetime", nullable: true, comment: "提交时间"),
TeacherId = table.Column<int>(type: "int", nullable: true, comment: "老师Id"),
TeacherName = table.Column<string>(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);
}
}
}