YD_SmartSports.Api/VOL.Core/Migrations/20240820075247_init037.cs

127 lines
4.7 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 init037 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CategoryId",
table: "N_SportsTestValue");
migrationBuilder.RenameColumn(
name: "CategoryId",
table: "S_GradeAssocCategory",
newName: "CategoryValue");
migrationBuilder.AddColumn<int>(
name: "CategoryValue",
table: "N_SportsTestValue",
type: "int",
nullable: false,
defaultValue: 0,
comment: "类别枚举值");
migrationBuilder.AlterColumn<string>(
name: "CategoryName",
table: "N_SportsTestCategory",
type: "nvarchar(100)",
nullable: true,
comment: "类别中文名称",
oldClrType: typeof(string),
oldType: "nvarchar(100)",
oldNullable: true,
oldComment: "类别名称");
migrationBuilder.AlterColumn<string>(
name: "CategoryEnum",
table: "N_SportsTestCategory",
type: "nvarchar(100)",
nullable: true,
comment: "类别枚举名称",
oldClrType: typeof(string),
oldType: "nvarchar(100)",
oldNullable: true,
oldComment: "类别名称");
migrationBuilder.AddColumn<int>(
name: "CategoryValue",
table: "N_SportsTestCategory",
type: "int",
nullable: false,
defaultValue: 0,
comment: "类别枚举值");
migrationBuilder.CreateTable(
name: "S_SchoolAssocGrade",
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: "学校编号"),
GradeId = table.Column<int>(type: "int", nullable: false, comment: "年级Id"),
Creator = table.Column<int>(type: "int", nullable: false, comment: "创建人"), // Fixed here
CreateDate = table.Column<DateTime>(type: "datetime", nullable: true, comment: "创建时间"),
Modifier = table.Column<int>(type: "int", nullable: false, comment: "修改人"), // Fixed here
ModifyDate = table.Column<DateTime>(type: "datetime", nullable: true, comment: "修改时间")
},
constraints: table =>
{
table.PrimaryKey("PK_S_SchoolAssocGrade", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "S_SchoolAssocGrade");
migrationBuilder.DropColumn(
name: "CategoryValue",
table: "N_SportsTestValue");
migrationBuilder.DropColumn(
name: "CategoryValue",
table: "N_SportsTestCategory");
migrationBuilder.RenameColumn(
name: "CategoryValue",
table: "S_GradeAssocCategory",
newName: "CategoryId");
migrationBuilder.AddColumn<int>(
name: "CategoryId",
table: "N_SportsTestValue",
type: "int",
nullable: false,
defaultValue: 0,
comment: "测试类别Id");
migrationBuilder.AlterColumn<string>(
name: "CategoryName",
table: "N_SportsTestCategory",
type: "nvarchar(100)",
nullable: true,
comment: "类别名称",
oldClrType: typeof(string),
oldType: "nvarchar(100)",
oldNullable: true,
oldComment: "类别中文名称");
migrationBuilder.AlterColumn<string>(
name: "CategoryEnum",
table: "N_SportsTestCategory",
type: "nvarchar(100)",
nullable: true,
comment: "类别名称",
oldClrType: typeof(string),
oldType: "nvarchar(100)",
oldNullable: true,
oldComment: "类别枚举名称");
}
}
}