123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- using System;
- using Microsoft.EntityFrameworkCore.Migrations;
- #nullable disable
- 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: false,
- defaultValue: 0m);
- 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: false,
- defaultValue: 0);
- migrationBuilder.AddColumn<decimal>(
- name: "TaxNumber",
- table: "AspNetUsers",
- type: "decimal(18,2)",
- nullable: false,
- defaultValue: 0m);
- migrationBuilder.AddColumn<string>(
- name: "University",
- table: "AspNetUsers",
- type: "nvarchar(max)",
- nullable: true);
- migrationBuilder.CreateTable(
- name: "AttachmentType",
- 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_AttachmentType", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "UserAttachment",
- 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_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");
- }
- /// <inheritdoc />
- 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");
- }
- }
- }
|