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( name: "CategoryValue", table: "N_SportsTestValue", type: "int", nullable: false, defaultValue: 0, comment: "类别枚举值"); migrationBuilder.AlterColumn( name: "CategoryName", table: "N_SportsTestCategory", type: "nvarchar(100)", nullable: true, comment: "类别中文名称", oldClrType: typeof(string), oldType: "nvarchar(100)", oldNullable: true, oldComment: "类别名称"); migrationBuilder.AlterColumn( name: "CategoryEnum", table: "N_SportsTestCategory", type: "nvarchar(100)", nullable: true, comment: "类别枚举名称", oldClrType: typeof(string), oldType: "nvarchar(100)", oldNullable: true, oldComment: "类别名称"); migrationBuilder.AddColumn( name: "CategoryValue", table: "N_SportsTestCategory", type: "int", nullable: false, defaultValue: 0, comment: "类别枚举值"); migrationBuilder.CreateTable( name: "S_SchoolAssocGrade", 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: "学校编号"), GradeId = table.Column(type: "int", nullable: false, comment: "年级Id"), Creator = table.Column(type: "int", nullable: false, comment: "创建人"), // Fixed here CreateDate = table.Column(type: "datetime", nullable: true, comment: "创建时间"), Modifier = table.Column(type: "int", nullable: false, comment: "修改人"), // Fixed here ModifyDate = table.Column(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( name: "CategoryId", table: "N_SportsTestValue", type: "int", nullable: false, defaultValue: 0, comment: "测试类别Id"); migrationBuilder.AlterColumn( name: "CategoryName", table: "N_SportsTestCategory", type: "nvarchar(100)", nullable: true, comment: "类别名称", oldClrType: typeof(string), oldType: "nvarchar(100)", oldNullable: true, oldComment: "类别中文名称"); migrationBuilder.AlterColumn( name: "CategoryEnum", table: "N_SportsTestCategory", type: "nvarchar(100)", nullable: true, comment: "类别名称", oldClrType: typeof(string), oldType: "nvarchar(100)", oldNullable: true, oldComment: "类别枚举名称"); } } }