using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace CMS.Plugin.HIAWms.MySQL.Migrations { public partial class InitialCreate17 : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropIndex( name: "IX_scms_wmsmaterials_MaterialType", table: "scms_wmsmaterials"); migrationBuilder.DropColumn( name: "MaterialType", table: "scms_wmsmaterials"); migrationBuilder.AddColumn( name: "MaterialTypeCode", table: "scms_wmsmaterials", type: "varchar(20)", maxLength: 20, nullable: true, comment: "物料类型编码") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "MaterialTypeDesc", table: "scms_wmsmaterials", type: "varchar(20)", maxLength: 20, nullable: true, comment: "物料类型") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "scms_wmsmaterialtype", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), MaterialTypeDesc = table.Column(type: "varchar(128)", maxLength: 128, nullable: false, comment: "类型描述") .Annotation("MySql:CharSet", "utf8mb4"), MaterialTypeCode = table.Column(type: "varchar(64)", maxLength: 64, nullable: false, comment: "类型编码") .Annotation("MySql:CharSet", "utf8mb4"), ExtraProperties = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), ConcurrencyStamp = table.Column(type: "varchar(40)", maxLength: 40, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), CreationTime = table.Column(type: "datetime(6)", nullable: false, comment: "创建时间"), CreatorId = table.Column(type: "char(36)", nullable: true, comment: "创建人ID", collation: "ascii_general_ci"), LastModificationTime = table.Column(type: "datetime(6)", nullable: true, comment: "最后修改时间"), LastModifierId = table.Column(type: "char(36)", nullable: true, comment: "最后修改人ID", collation: "ascii_general_ci"), IsDeleted = table.Column(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "是否已删除"), DeleterId = table.Column(type: "char(36)", nullable: true, comment: "删除人ID", collation: "ascii_general_ci"), DeletionTime = table.Column(type: "datetime(6)", nullable: true, comment: "删除时间"), CreatorName = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), LastModifierName = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), OperationRemark = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), DeleteRemark = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Sort = table.Column(type: "int", nullable: false), Remark = table.Column(type: "varchar(50)", maxLength: 50, nullable: true, comment: "备注") .Annotation("MySql:CharSet", "utf8mb4"), IsDisabled = table.Column(type: "tinyint(1)", nullable: true), ExtraField1 = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), ExtraField2 = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), ExtraField3 = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => { table.PrimaryKey("PK_scms_wmsmaterialtype", x => x.Id); }, comment: "物料类型表") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_scms_wmsmaterials_MaterialTypeCode", table: "scms_wmsmaterials", column: "MaterialTypeCode"); migrationBuilder.CreateIndex( name: "IX_scms_wmsmaterialtype_MaterialTypeCode", table: "scms_wmsmaterialtype", column: "MaterialTypeCode", unique: true); migrationBuilder.CreateIndex( name: "IX_scms_wmsmaterialtype_MaterialTypeDesc", table: "scms_wmsmaterialtype", column: "MaterialTypeDesc"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "scms_wmsmaterialtype"); migrationBuilder.DropIndex( name: "IX_scms_wmsmaterials_MaterialTypeCode", table: "scms_wmsmaterials"); migrationBuilder.DropColumn( name: "MaterialTypeCode", table: "scms_wmsmaterials"); migrationBuilder.DropColumn( name: "MaterialTypeDesc", table: "scms_wmsmaterials"); migrationBuilder.AddColumn( name: "MaterialType", table: "scms_wmsmaterials", type: "int", nullable: false, defaultValue: 0, comment: "物料类型(枚举值)"); migrationBuilder.CreateIndex( name: "IX_scms_wmsmaterials_MaterialType", table: "scms_wmsmaterials", column: "MaterialType"); } } }