20260106071718_Migration_20260106151700.cs
3.68 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
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Rcs.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class Migration_20260106151700 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "storage_areas",
columns: table => new
{
area_id = table.Column<Guid>(type: "uuid", nullable: false),
area_code = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
area_name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
description = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: true),
is_active = table.Column<bool>(type: "boolean", nullable: false),
created_at = table.Column<DateTime>(type: "timestamp", nullable: false),
updated_at = table.Column<DateTime>(type: "timestamp", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_storage_areas", x => x.area_id);
});
migrationBuilder.CreateTable(
name: "storage_locations",
columns: table => new
{
location_id = table.Column<Guid>(type: "uuid", nullable: false),
area_id = table.Column<Guid>(type: "uuid", nullable: false),
map_node_id = table.Column<Guid>(type: "uuid", nullable: true),
location_code = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
location_name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
status = table.Column<int>(type: "integer", nullable: false),
is_active = table.Column<bool>(type: "boolean", nullable: false),
created_at = table.Column<DateTime>(type: "timestamp", nullable: false),
updated_at = table.Column<DateTime>(type: "timestamp", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_storage_locations", x => x.location_id);
table.ForeignKey(
name: "FK_storage_locations_map_nodes_map_node_id",
column: x => x.map_node_id,
principalTable: "map_nodes",
principalColumn: "node_id");
table.ForeignKey(
name: "FK_storage_locations_storage_areas_area_id",
column: x => x.area_id,
principalTable: "storage_areas",
principalColumn: "area_id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_storage_locations_area_id",
table: "storage_locations",
column: "area_id");
migrationBuilder.CreateIndex(
name: "IX_storage_locations_map_node_id",
table: "storage_locations",
column: "map_node_id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "storage_locations");
migrationBuilder.DropTable(
name: "storage_areas");
}
}
}