using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace YD_WeChatApplet.Api.Migrations { public partial class init006 : Migration { protected override void Up(MigrationBuilder migrationBuilder) { // 修改 Remarks 字段,允许为 null migrationBuilder.AlterColumn( name: "Remarks", table: "User", type: "text", nullable: true, comment: "备注", oldClrType: typeof(string), oldType: "text", oldNullable: false, // 表示之前是不允许 null oldComment: "备注"); // 修改 Modifier 字段,允许为 null migrationBuilder.AlterColumn( name: "Modifier", table: "User", type: "int", // 去掉多余的右括号 nullable: true, comment: "修改人", oldClrType: typeof(int), oldType: "int", oldNullable: false, // 表示之前是不允许 null oldComment: "修改人"); // 修改 Creator 字段,允许为 null migrationBuilder.AlterColumn( name: "Creator", table: "User", type: "int", // 去掉多余的右括号 nullable: true, comment: "创建人", oldClrType: typeof(int), oldType: "int", oldNullable: false, // 表示之前是不允许 null oldComment: "创建人"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.AlterColumn( name: "Remarks", table: "User", type: "text", nullable: false, defaultValue: "", comment: "备注", oldClrType: typeof(string), oldType: "text", oldNullable: true, oldComment: "备注"); migrationBuilder.AlterColumn( name: "Modifier", table: "User", type: "int)", nullable: false, defaultValue: 0, comment: "修改人", oldClrType: typeof(int), oldType: "int)", oldNullable: true, oldComment: "修改人"); migrationBuilder.AlterColumn( name: "Creator", table: "User", type: "int)", nullable: false, defaultValue: 0, comment: "创建人", oldClrType: typeof(int), oldType: "int)", oldNullable: true, oldComment: "创建人"); } } }