123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- using System;
- using Microsoft.EntityFrameworkCore.Migrations;
- #nullable disable
- #pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
- namespace MTWorkHR.Identity.Migrations
- {
- /// <inheritdoc />
- public partial class updateUser : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn<string>(
- name: "FavoriteName",
- table: "AspNetUsers",
- type: "nvarchar(max)",
- nullable: true);
- migrationBuilder.AddColumn<decimal>(
- name: "IncomeTaxValue",
- table: "AspNetUsers",
- type: "decimal(18,2)",
- nullable: true);
- migrationBuilder.AddColumn<string>(
- name: "JobTitle",
- table: "AspNetUsers",
- type: "nvarchar(max)",
- nullable: true);
- migrationBuilder.AddColumn<string>(
- name: "PassportNumber",
- table: "AspNetUsers",
- type: "nvarchar(max)",
- nullable: false,
- defaultValue: "");
- migrationBuilder.AddColumn<int>(
- name: "QualificationId",
- table: "AspNetUsers",
- type: "int",
- nullable: true);
- migrationBuilder.AddColumn<decimal>(
- name: "TaxNumber",
- table: "AspNetUsers",
- type: "decimal(18,2)",
- nullable: true);
- migrationBuilder.AddColumn<string>(
- name: "University",
- table: "AspNetUsers",
- type: "nvarchar(max)",
- nullable: true);
- migrationBuilder.CreateTable(
- name: "AttachmentTypes",
- columns: table => new
- {
- Id = table.Column<long>(type: "bigint", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- NameAr = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
- NameEn = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
- IsRequired = table.Column<bool>(type: "bit", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AttachmentTypes", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "UserAddress",
- columns: table => new
- {
- Id = table.Column<long>(type: "bigint", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- CreateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
- UpdateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
- CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
- UpdateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
- UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
- CountryId = table.Column<int>(type: "int", nullable: false),
- City = table.Column<string>(type: "nvarchar(max)", nullable: false),
- PostalCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
- AddressDesc = table.Column<string>(type: "nvarchar(max)", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_UserAddress", x => x.Id);
- table.ForeignKey(
- name: "FK_UserAddress_AspNetUsers_UserId",
- column: x => x.UserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
- migrationBuilder.CreateTable(
- name: "UserAttachments",
- columns: table => new
- {
- Id = table.Column<long>(type: "bigint", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- CreateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
- UpdateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
- CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
- UpdateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
- UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
- AttachmentTypeId = table.Column<long>(type: "bigint", nullable: false),
- FileName = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
- OriginalName = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_UserAttachments", x => x.Id);
- table.ForeignKey(
- name: "FK_UserAttachments_AspNetUsers_UserId",
- column: x => x.UserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_UserAttachments_AttachmentTypes_AttachmentTypeId",
- column: x => x.AttachmentTypeId,
- principalTable: "AttachmentTypes",
- 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, 1m, null, "1234567", 1, 111m, 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, 100m, null, "7654321001010", 1, 222m, null });
- migrationBuilder.InsertData(
- table: "AttachmentTypes",
- columns: new[] { "Id", "IsRequired", "NameAr", "NameEn" },
- values: new object[,]
- {
- { 1L, false, "السيرة الذاتية", "CV" },
- { 2L, false, "الهوية", "Identification" }
- });
- migrationBuilder.CreateIndex(
- name: "IX_UserAddress_UserId",
- table: "UserAddress",
- column: "UserId",
- unique: true);
- migrationBuilder.CreateIndex(
- name: "IX_UserAttachments_AttachmentTypeId",
- table: "UserAttachments",
- column: "AttachmentTypeId");
- migrationBuilder.CreateIndex(
- name: "IX_UserAttachments_UserId",
- table: "UserAttachments",
- column: "UserId");
- }
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "UserAddress");
- migrationBuilder.DropTable(
- name: "UserAttachments");
- migrationBuilder.DropTable(
- name: "AttachmentTypes");
- 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");
- }
- }
- }
|