using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace MTWorkHR.Identity.Migrations { /// public partial class updateUser : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "FavoriteName", table: "AspNetUsers", type: "nvarchar(max)", nullable: true); migrationBuilder.AddColumn( name: "IncomeTaxValue", table: "AspNetUsers", type: "decimal(18,2)", nullable: false, defaultValue: 0m); migrationBuilder.AddColumn( name: "JobTitle", table: "AspNetUsers", type: "nvarchar(max)", nullable: true); migrationBuilder.AddColumn( name: "PassportNumber", table: "AspNetUsers", type: "nvarchar(max)", nullable: false, defaultValue: ""); migrationBuilder.AddColumn( name: "QualificationId", table: "AspNetUsers", type: "int", nullable: false, defaultValue: 0); migrationBuilder.AddColumn( name: "TaxNumber", table: "AspNetUsers", type: "decimal(18,2)", nullable: false, defaultValue: 0m); migrationBuilder.AddColumn( name: "University", table: "AspNetUsers", type: "nvarchar(max)", nullable: true); migrationBuilder.CreateTable( name: "AttachmentType", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), NameAr = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), NameEn = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), IsRequired = table.Column(type: "bit", nullable: false) }, constraints: table => { table.PrimaryKey("PK_AttachmentType", x => x.Id); }); migrationBuilder.CreateTable( name: "UserAttachment", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), CreateUser = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: true), UpdateUser = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: true), CreateDate = table.Column(type: "datetime2", nullable: false), UpdateDate = table.Column(type: "datetime2", nullable: true), UserId = table.Column(type: "nvarchar(450)", nullable: false), AttachmentTypeId = table.Column(type: "bigint", nullable: false), FileName = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), OriginalName = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false) }, constraints: table => { table.PrimaryKey("PK_UserAttachment", x => x.Id); table.ForeignKey( name: "FK_UserAttachment_AspNetUsers_UserId", column: x => x.UserId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_UserAttachment_AttachmentType_AttachmentTypeId", column: x => x.AttachmentTypeId, principalTable: "AttachmentType", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.UpdateData( table: "AspNetUsers", keyColumn: "Id", keyValue: "ADMB3B92-2311-48F8-9DEC-F9FAEF1F21UA", columns: new[] { "FavoriteName", "IncomeTaxValue", "JobTitle", "PassportNumber", "QualificationId", "TaxNumber", "University" }, values: new object[] { null, 0m, null, "1234567", 0, 0m, null }); migrationBuilder.UpdateData( table: "AspNetUsers", keyColumn: "Id", keyValue: "AL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB", columns: new[] { "FavoriteName", "IncomeTaxValue", "JobTitle", "PassportNumber", "QualificationId", "TaxNumber", "University" }, values: new object[] { null, 0m, null, "7654321001010", 0, 0m, null }); migrationBuilder.CreateIndex( name: "IX_UserAttachment_AttachmentTypeId", table: "UserAttachment", column: "AttachmentTypeId"); migrationBuilder.CreateIndex( name: "IX_UserAttachment_UserId", table: "UserAttachment", column: "UserId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "UserAttachment"); migrationBuilder.DropTable( name: "AttachmentType"); migrationBuilder.DropColumn( name: "FavoriteName", table: "AspNetUsers"); migrationBuilder.DropColumn( name: "IncomeTaxValue", table: "AspNetUsers"); migrationBuilder.DropColumn( name: "JobTitle", table: "AspNetUsers"); migrationBuilder.DropColumn( name: "PassportNumber", table: "AspNetUsers"); migrationBuilder.DropColumn( name: "QualificationId", table: "AspNetUsers"); migrationBuilder.DropColumn( name: "TaxNumber", table: "AspNetUsers"); migrationBuilder.DropColumn( name: "University", table: "AspNetUsers"); } } }