133 lines
6.2 KiB
C#
133 lines
6.2 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddIdentityUser : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropColumn(
|
|
name: "IsMutiAccountInfoConfirm",
|
|
table: "User");
|
|
|
|
migrationBuilder.AlterTable(
|
|
name: "User",
|
|
comment: "后台 - 系统账户角色关系表",
|
|
oldComment: "后台 - 系统账户");
|
|
|
|
migrationBuilder.AlterColumn<bool>(
|
|
name: "SuperAdmin",
|
|
table: "User",
|
|
type: "bit",
|
|
nullable: false,
|
|
comment: "后续删除",
|
|
oldClrType: typeof(bool),
|
|
oldType: "bit");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "IdentityUser",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
Code = table.Column<int>(type: "int", nullable: false),
|
|
UserCode = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
|
|
UserName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
|
|
EMail = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
|
|
EmailToken = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
|
|
FirstName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
|
|
LastName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
|
|
Password = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
|
|
PasswordChanged = table.Column<bool>(type: "bit", nullable: false),
|
|
Phone = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
|
|
Sex = table.Column<int>(type: "int", nullable: true),
|
|
Status = table.Column<int>(type: "int", nullable: false),
|
|
OrganizationName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
|
|
PositionName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
|
|
AutoCutNextTask = table.Column<bool>(type: "bit", nullable: false, comment: "自动切换下一个任务"),
|
|
DepartmentName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
|
|
IsFirstAdd = table.Column<bool>(type: "bit", nullable: false, comment: "首次登录需要修改密码"),
|
|
IsTestUser = table.Column<bool>(type: "bit", nullable: false),
|
|
IsZhiZhun = table.Column<bool>(type: "bit", nullable: false, comment: "内部用户 外部用户"),
|
|
LastChangePassWordTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "上一次修改密码的时间"),
|
|
LastLoginIP = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
|
|
LastLoginTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
UpdateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_IdentityUser", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_IdentityUser_User_CreateUserId",
|
|
column: x => x.CreateUserId,
|
|
principalTable: "User",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
},
|
|
comment: "后台 - 系统真实账户表");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_User_IdentityUserId",
|
|
table: "User",
|
|
column: "IdentityUserId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_IdentityUser_CreateUserId",
|
|
table: "IdentityUser",
|
|
column: "CreateUserId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_User_IdentityUser_IdentityUserId",
|
|
table: "User",
|
|
column: "IdentityUserId",
|
|
principalTable: "IdentityUser",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_User_IdentityUser_IdentityUserId",
|
|
table: "User");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "IdentityUser");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_User_IdentityUserId",
|
|
table: "User");
|
|
|
|
migrationBuilder.AlterTable(
|
|
name: "User",
|
|
comment: "后台 - 系统账户",
|
|
oldComment: "后台 - 系统账户角色关系表");
|
|
|
|
migrationBuilder.AlterColumn<bool>(
|
|
name: "SuperAdmin",
|
|
table: "User",
|
|
type: "bit",
|
|
nullable: false,
|
|
oldClrType: typeof(bool),
|
|
oldType: "bit",
|
|
oldComment: "后续删除");
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "IsMutiAccountInfoConfirm",
|
|
table: "User",
|
|
type: "bit",
|
|
nullable: false,
|
|
defaultValue: false,
|
|
comment: "多账号信息是否已经确认");
|
|
}
|
|
}
|
|
}
|