mh_custom/wtmProject.DataAccess/Migrations/20240326095031_hmr2024032601.cs

149 lines
7.6 KiB
C#
Raw Normal View History

2024-05-16 17:30:33 +08:00
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace wtmProject.DataAccess.Migrations
{
public partial class hmr2024032601 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "WTM_AREA",
columns: table => new
{
ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
AreaCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
AreaName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
TenantCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
CreateBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_WTM_AREA", x => x.ID);
});
migrationBuilder.CreateTable(
name: "WTM_PROJECT",
columns: table => new
{
ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ProjectCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
ProjectName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
TenantCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
CreateBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_WTM_PROJECT", x => x.ID);
});
migrationBuilder.CreateTable(
name: "WTM_USER",
columns: table => new
{
ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Code = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
Gender = table.Column<int>(type: "int", nullable: true),
Password = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
IsValid = table.Column<bool>(type: "bit", nullable: false),
PhotoId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
CellPhone = table.Column<string>(type: "nvarchar(max)", nullable: true),
TenantCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
DepartmentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
CreateBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_WTM_USER", x => x.ID);
table.ForeignKey(
name: "FK_WTM_USER_FileAttachments_PhotoId",
column: x => x.PhotoId,
principalTable: "FileAttachments",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_WTM_USER_FrameworkGroups_DepartmentId",
column: x => x.DepartmentId,
principalTable: "FrameworkGroups",
principalColumn: "ID");
});
migrationBuilder.CreateTable(
name: "WTM_USER_AREA",
columns: table => new
{
ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
UserCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
AreaCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
TenantCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
CreateBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_WTM_USER_AREA", x => x.ID);
});
migrationBuilder.CreateTable(
name: "WTM_USER_PROJECT",
columns: table => new
{
ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
UserCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
ProjectCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
TenantCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
CreateBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_WTM_USER_PROJECT", x => x.ID);
});
migrationBuilder.CreateIndex(
name: "IX_WTM_USER_DepartmentId",
table: "WTM_USER",
column: "DepartmentId");
migrationBuilder.CreateIndex(
name: "IX_WTM_USER_PhotoId",
table: "WTM_USER",
column: "PhotoId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "WTM_AREA");
migrationBuilder.DropTable(
name: "WTM_PROJECT");
migrationBuilder.DropTable(
name: "WTM_USER");
migrationBuilder.DropTable(
name: "WTM_USER_AREA");
migrationBuilder.DropTable(
name: "WTM_USER_PROJECT");
}
}
}