AGSSbackend/AGSS/Migrations/20250714031454_AddMenuTable.cs
2025-07-14 15:10:13 +08:00

57 lines
2.6 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AGSS.Migrations
{
/// <inheritdoc />
public partial class AddMenuTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Menus",
columns: table => new
{
Uuid = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
ParentId = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true),
Path = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
Label = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
Icon = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
MenuCode = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: true),
Adaptability = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
Component = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
Sort = table.Column<int>(type: "integer", nullable: false),
Status = table.Column<string>(type: "character varying(1)", maxLength: 1, nullable: false),
Query = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
CreateTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UpdateTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Menus", x => x.Uuid);
table.ForeignKey(
name: "FK_Menus_Menus_ParentId",
column: x => x.ParentId,
principalTable: "Menus",
principalColumn: "Uuid",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_Menus_ParentId",
table: "Menus",
column: "ParentId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Menus");
}
}
}