@@ -11,34 +11,90 @@ protected override void Up(MigrationBuilder migrationBuilder)
11
11
name : "ShopsUI_ItemShops" ,
12
12
columns : table => new
13
13
{
14
- ItemShopId = table . Column < int > ( nullable : false )
15
- . Annotation ( "MySql:ValueGenerationStrategy" , MySqlValueGenerationStrategy . IdentityColumn ) ,
16
- BuyPrice = table . Column < decimal > ( nullable : true ) ,
17
- SellPrice = table . Column < decimal > ( nullable : true ) ,
14
+ ItemId = table . Column < ushort > ( nullable : false ) ,
15
+ BuyPrice = table . Column < decimal > ( type : "decimal(24,2)" , nullable : true ) ,
16
+ SellPrice = table . Column < decimal > ( type : "decimal(24,2)" , nullable : true ) ,
18
17
Order = table . Column < int > ( nullable : false )
19
18
} ,
20
19
constraints : table =>
21
20
{
22
- table . PrimaryKey ( "PK_ShopsUI_ItemShops" , x => x . ItemShopId ) ;
21
+ table . PrimaryKey ( "PK_ShopsUI_ItemShops" , x => x . ItemId ) ;
23
22
} ) ;
24
23
25
24
migrationBuilder . CreateTable (
26
25
name : "ShopsUI_VehicleShops" ,
27
26
columns : table => new
28
27
{
29
- VehicleShopId = table . Column < int > ( nullable : false )
30
- . Annotation ( "MySql:ValueGenerationStrategy" , MySqlValueGenerationStrategy . IdentityColumn ) ,
31
- BuyPrice = table . Column < decimal > ( nullable : false ) ,
28
+ VehicleId = table . Column < ushort > ( nullable : false ) ,
29
+ BuyPrice = table . Column < decimal > ( type : "decimal(24,2)" , nullable : false ) ,
32
30
Order = table . Column < int > ( nullable : false )
33
31
} ,
34
32
constraints : table =>
35
33
{
36
- table . PrimaryKey ( "PK_ShopsUI_VehicleShops" , x => x . VehicleShopId ) ;
34
+ table . PrimaryKey ( "PK_ShopsUI_VehicleShops" , x => x . VehicleId ) ;
35
+ } ) ;
36
+
37
+ migrationBuilder . CreateTable (
38
+ name : "ShopsUI_ItemGroups" ,
39
+ columns : table => new
40
+ {
41
+ Id = table . Column < int > ( nullable : false )
42
+ . Annotation ( "MySql:ValueGenerationStrategy" , MySqlValueGenerationStrategy . IdentityColumn ) ,
43
+ Permission = table . Column < string > ( nullable : false ) ,
44
+ IsWhitelist = table . Column < bool > ( nullable : false ) ,
45
+ ItemShopItemId = table . Column < ushort > ( nullable : false )
46
+ } ,
47
+ constraints : table =>
48
+ {
49
+ table . PrimaryKey ( "PK_ShopsUI_ItemGroups" , x => x . Id ) ;
50
+ table . ForeignKey (
51
+ name : "FK_ShopsUI_ItemGroups_ShopsUI_ItemShops_ItemShopItemId" ,
52
+ column : x => x . ItemShopItemId ,
53
+ principalTable : "ShopsUI_ItemShops" ,
54
+ principalColumn : "ItemId" ,
55
+ onDelete : ReferentialAction . Cascade ) ;
56
+ } ) ;
57
+
58
+ migrationBuilder . CreateTable (
59
+ name : "ShopsUI_VehicleGroups" ,
60
+ columns : table => new
61
+ {
62
+ Id = table . Column < int > ( nullable : false )
63
+ . Annotation ( "MySql:ValueGenerationStrategy" , MySqlValueGenerationStrategy . IdentityColumn ) ,
64
+ Permission = table . Column < string > ( nullable : false ) ,
65
+ IsWhitelist = table . Column < bool > ( nullable : false ) ,
66
+ VehicleShopVehicleId = table . Column < ushort > ( nullable : false )
67
+ } ,
68
+ constraints : table =>
69
+ {
70
+ table . PrimaryKey ( "PK_ShopsUI_VehicleGroups" , x => x . Id ) ;
71
+ table . ForeignKey (
72
+ name : "FK_ShopsUI_VehicleGroups_ShopsUI_VehicleShops_VehicleShopVehicl~" ,
73
+ column : x => x . VehicleShopVehicleId ,
74
+ principalTable : "ShopsUI_VehicleShops" ,
75
+ principalColumn : "VehicleId" ,
76
+ onDelete : ReferentialAction . Cascade ) ;
37
77
} ) ;
78
+
79
+ migrationBuilder . CreateIndex (
80
+ name : "IX_ShopsUI_ItemGroups_ItemShopItemId" ,
81
+ table : "ShopsUI_ItemGroups" ,
82
+ column : "ItemShopItemId" ) ;
83
+
84
+ migrationBuilder . CreateIndex (
85
+ name : "IX_ShopsUI_VehicleGroups_VehicleShopVehicleId" ,
86
+ table : "ShopsUI_VehicleGroups" ,
87
+ column : "VehicleShopVehicleId" ) ;
38
88
}
39
89
40
90
protected override void Down ( MigrationBuilder migrationBuilder )
41
91
{
92
+ migrationBuilder . DropTable (
93
+ name : "ShopsUI_ItemGroups" ) ;
94
+
95
+ migrationBuilder . DropTable (
96
+ name : "ShopsUI_VehicleGroups" ) ;
97
+
42
98
migrationBuilder . DropTable (
43
99
name : "ShopsUI_ItemShops" ) ;
44
100
0 commit comments