zs
2025-05-15 edba4ede85a3d82a7f0a0a7dccddbc8281862888
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
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<string>(
                name: "MaterialTypeCode",
                table: "scms_wmsmaterials",
                type: "varchar(20)",
                maxLength: 20,
                nullable: true,
                comment: "物料类型编码")
                .Annotation("MySql:CharSet", "utf8mb4");
 
            migrationBuilder.AddColumn<string>(
                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<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    MaterialTypeDesc = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false, comment: "类型描述")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MaterialTypeCode = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "类型编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "创建时间"),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "创建人ID", collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "最后修改时间"),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "最后修改人ID", collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "是否已删除"),
                    DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "删除人ID", collation: "ascii_general_ci"),
                    DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "删除时间"),
                    CreatorName = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    LastModifierName = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OperationRemark = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DeleteRemark = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Sort = table.Column<int>(type: "int", nullable: false),
                    Remark = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "备注")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsDisabled = table.Column<bool>(type: "tinyint(1)", nullable: true),
                    ExtraField1 = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ExtraField2 = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ExtraField3 = table.Column<string>(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<int>(
                name: "MaterialType",
                table: "scms_wmsmaterials",
                type: "int",
                nullable: false,
                defaultValue: 0,
                comment: "物料类型(枚举值)");
 
            migrationBuilder.CreateIndex(
                name: "IX_scms_wmsmaterials_MaterialType",
                table: "scms_wmsmaterials",
                column: "MaterialType");
        }
    }
}