20260204025553_Migration_20260204105546.cs
4.51 KB
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
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Rcs.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class Migration_20260204105546 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "cache_columns",
table: "robots",
type: "integer",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "cache_levels",
table: "robots",
type: "integer",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "cache_rows",
table: "robots",
type: "integer",
nullable: true);
migrationBuilder.CreateTable(
name: "robot_cache_locations",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
robot_id = table.Column<Guid>(type: "uuid", nullable: false),
location_code = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
row = table.Column<int>(type: "integer", nullable: false),
column = table.Column<int>(type: "integer", nullable: false),
level = table.Column<int>(type: "integer", nullable: false),
container_id = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
material_code = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
material_name = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
quantity = table.Column<double>(type: "double precision", nullable: true),
weight = table.Column<double>(type: "double precision", nullable: true),
remark = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: true),
created_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
updated_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_robot_cache_locations", x => x.id);
table.ForeignKey(
name: "FK_robot_cache_locations_robots_robot_id",
column: x => x.robot_id,
principalTable: "robots",
principalColumn: "robot_id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "idx_robot_cache_location_code",
table: "robot_cache_locations",
column: "location_code");
migrationBuilder.CreateIndex(
name: "idx_robot_cache_location_column",
table: "robot_cache_locations",
column: "column");
migrationBuilder.CreateIndex(
name: "idx_robot_cache_location_level",
table: "robot_cache_locations",
column: "level");
migrationBuilder.CreateIndex(
name: "idx_robot_cache_location_position",
table: "robot_cache_locations",
columns: new[] { "row", "column", "level" });
migrationBuilder.CreateIndex(
name: "idx_robot_cache_location_robot_id",
table: "robot_cache_locations",
column: "robot_id");
migrationBuilder.CreateIndex(
name: "idx_robot_cache_location_row",
table: "robot_cache_locations",
column: "row");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "robot_cache_locations");
migrationBuilder.DropColumn(
name: "cache_columns",
table: "robots");
migrationBuilder.DropColumn(
name: "cache_levels",
table: "robots");
migrationBuilder.DropColumn(
name: "cache_rows",
table: "robots");
}
}
}