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