123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824 |
- using System;
- using Microsoft.EntityFrameworkCore.Migrations;
- #nullable disable
- #pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
- namespace MTWorkHR.Infrastructure.Migrations
- {
- /// <inheritdoc />
- public partial class initial : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "AspNetRoles",
- columns: table => new
- {
- Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
- CreateUser = table.Column<string>(type: "nvarchar(max)", nullable: true),
- UpdateUser = table.Column<string>(type: "nvarchar(max)", nullable: true),
- CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
- UpdateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
- IsDeleted = table.Column<bool>(type: "bit", nullable: false),
- DeleteUserId = table.Column<string>(type: "nvarchar(max)", nullable: true),
- IsAdmin = table.Column<bool>(type: "bit", nullable: true),
- Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
- NormalizedName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
- ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetRoles", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "AspNetUsers",
- columns: table => new
- {
- Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
- FirstName = table.Column<string>(type: "nvarchar(max)", nullable: false),
- LastName = table.Column<string>(type: "nvarchar(max)", nullable: false),
- UserType = table.Column<int>(type: "int", nullable: false),
- FavoriteName = table.Column<string>(type: "nvarchar(max)", nullable: true),
- PassportNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
- QualificationId = table.Column<int>(type: "int", nullable: true),
- University = table.Column<string>(type: "nvarchar(max)", nullable: true),
- JobTitle = table.Column<string>(type: "nvarchar(max)", nullable: true),
- ManagerId = table.Column<string>(type: "nvarchar(450)", nullable: true),
- TaxNumber = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
- IncomeTaxValue = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
- CreateUser = table.Column<string>(type: "nvarchar(max)", nullable: true),
- UpdateUser = table.Column<string>(type: "nvarchar(max)", nullable: true),
- IsStopped = table.Column<bool>(type: "bit", nullable: false),
- IsDeleted = table.Column<bool>(type: "bit", nullable: false),
- DeleteUserId = table.Column<string>(type: "nvarchar(max)", nullable: true),
- UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
- NormalizedUserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
- Email = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
- NormalizedEmail = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
- EmailConfirmed = table.Column<bool>(type: "bit", nullable: false),
- PasswordHash = table.Column<string>(type: "nvarchar(max)", nullable: true),
- SecurityStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
- ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
- PhoneNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
- PhoneNumberConfirmed = table.Column<bool>(type: "bit", nullable: false),
- TwoFactorEnabled = table.Column<bool>(type: "bit", nullable: false),
- LockoutEnd = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
- LockoutEnabled = table.Column<bool>(type: "bit", nullable: false),
- AccessFailedCount = table.Column<int>(type: "int", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetUsers", x => x.Id);
- table.ForeignKey(
- name: "FK_AspNetUsers_AspNetUsers_ManagerId",
- column: x => x.ManagerId,
- principalTable: "AspNetUsers",
- principalColumn: "Id");
- });
- 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: "AuthLogs",
- columns: table => new
- {
- Id = table.Column<long>(type: "bigint", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- Method = table.Column<string>(type: "nvarchar(max)", nullable: false),
- QueryString = table.Column<string>(type: "nvarchar(max)", nullable: true),
- Input = table.Column<string>(type: "nvarchar(max)", nullable: true),
- CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
- CreateUser = table.Column<string>(type: "nvarchar(max)", nullable: false),
- ServerIP = table.Column<string>(type: "nvarchar(max)", nullable: true),
- Channel = table.Column<string>(type: "nvarchar(max)", nullable: true),
- UserIP = table.Column<string>(type: "nvarchar(max)", nullable: true),
- ServiceResponseTimeInSeconds = table.Column<string>(type: "nvarchar(max)", nullable: false),
- ErrorCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
- ErrorDescription = table.Column<string>(type: "nvarchar(max)", nullable: false),
- InnerException = table.Column<string>(type: "nvarchar(max)", nullable: true),
- userAgent = table.Column<string>(type: "nvarchar(max)", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AuthLogs", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "Companies",
- 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<long>(type: "bigint", nullable: false),
- CompanyName = table.Column<string>(type: "nvarchar(max)", nullable: false),
- CRNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
- TaxNumber = table.Column<int>(type: "int", nullable: false),
- IsDeleted = table.Column<bool>(type: "bit", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Companies", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "FileLogs",
- columns: table => new
- {
- Id = table.Column<long>(type: "bigint", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- Method = table.Column<string>(type: "nvarchar(max)", nullable: false),
- QueryString = table.Column<string>(type: "nvarchar(max)", nullable: true),
- Input = table.Column<string>(type: "nvarchar(max)", nullable: true),
- CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
- CreateUser = table.Column<string>(type: "nvarchar(max)", nullable: false),
- ServerIP = table.Column<string>(type: "nvarchar(max)", nullable: true),
- Channel = table.Column<string>(type: "nvarchar(max)", nullable: true),
- UserIP = table.Column<string>(type: "nvarchar(max)", nullable: true),
- ServiceResponseTimeInSeconds = table.Column<string>(type: "nvarchar(max)", nullable: false),
- ErrorCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
- ErrorDescription = table.Column<string>(type: "nvarchar(max)", nullable: false),
- InnerException = table.Column<string>(type: "nvarchar(max)", nullable: true),
- userAgent = table.Column<string>(type: "nvarchar(max)", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_FileLogs", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "Permissions",
- columns: table => new
- {
- Id = table.Column<long>(type: "bigint", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- Name = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
- CategoryName = table.Column<string>(type: "nvarchar(150)", maxLength: 150, nullable: false),
- Desc = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
- Show = table.Column<bool>(type: "bit", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Permissions", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "Projects",
- 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)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Projects", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "RoleLogs",
- columns: table => new
- {
- Id = table.Column<long>(type: "bigint", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- Method = table.Column<string>(type: "nvarchar(max)", nullable: false),
- QueryString = table.Column<string>(type: "nvarchar(max)", nullable: true),
- Input = table.Column<string>(type: "nvarchar(max)", nullable: true),
- CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
- CreateUser = table.Column<string>(type: "nvarchar(max)", nullable: false),
- ServerIP = table.Column<string>(type: "nvarchar(max)", nullable: true),
- Channel = table.Column<string>(type: "nvarchar(max)", nullable: true),
- UserIP = table.Column<string>(type: "nvarchar(max)", nullable: true),
- ServiceResponseTimeInSeconds = table.Column<string>(type: "nvarchar(max)", nullable: false),
- ErrorCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
- ErrorDescription = table.Column<string>(type: "nvarchar(max)", nullable: false),
- InnerException = table.Column<string>(type: "nvarchar(max)", nullable: true),
- userAgent = table.Column<string>(type: "nvarchar(max)", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_RoleLogs", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "SettingLogs",
- columns: table => new
- {
- Id = table.Column<long>(type: "bigint", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- Method = table.Column<string>(type: "nvarchar(max)", nullable: false),
- QueryString = table.Column<string>(type: "nvarchar(max)", nullable: true),
- Input = table.Column<string>(type: "nvarchar(max)", nullable: true),
- CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
- CreateUser = table.Column<string>(type: "nvarchar(max)", nullable: false),
- ServerIP = table.Column<string>(type: "nvarchar(max)", nullable: true),
- Channel = table.Column<string>(type: "nvarchar(max)", nullable: true),
- UserIP = table.Column<string>(type: "nvarchar(max)", nullable: true),
- ServiceResponseTimeInSeconds = table.Column<string>(type: "nvarchar(max)", nullable: false),
- ErrorCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
- ErrorDescription = table.Column<string>(type: "nvarchar(max)", nullable: false),
- InnerException = table.Column<string>(type: "nvarchar(max)", nullable: true),
- userAgent = table.Column<string>(type: "nvarchar(max)", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_SettingLogs", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "UserLogs",
- columns: table => new
- {
- Id = table.Column<long>(type: "bigint", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- Method = table.Column<string>(type: "nvarchar(max)", nullable: false),
- QueryString = table.Column<string>(type: "nvarchar(max)", nullable: true),
- Input = table.Column<string>(type: "nvarchar(max)", nullable: true),
- CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
- CreateUser = table.Column<string>(type: "nvarchar(max)", nullable: false),
- ServerIP = table.Column<string>(type: "nvarchar(max)", nullable: true),
- Channel = table.Column<string>(type: "nvarchar(max)", nullable: true),
- UserIP = table.Column<string>(type: "nvarchar(max)", nullable: true),
- ServiceResponseTimeInSeconds = table.Column<string>(type: "nvarchar(max)", nullable: false),
- ErrorCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
- ErrorDescription = table.Column<string>(type: "nvarchar(max)", nullable: false),
- InnerException = table.Column<string>(type: "nvarchar(max)", nullable: true),
- userAgent = table.Column<string>(type: "nvarchar(max)", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_UserLogs", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "UserTaskStatuses",
- 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)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_UserTaskStatuses", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "AspNetRoleClaims",
- columns: table => new
- {
- Id = table.Column<int>(type: "int", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false),
- ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
- ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
- table.ForeignKey(
- name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
- column: x => x.RoleId,
- principalTable: "AspNetRoles",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
- migrationBuilder.CreateTable(
- name: "ApplicationRoleApplicationUser",
- columns: table => new
- {
- UserRolesId = table.Column<string>(type: "nvarchar(450)", nullable: false),
- UsersId = table.Column<string>(type: "nvarchar(450)", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_ApplicationRoleApplicationUser", x => new { x.UserRolesId, x.UsersId });
- table.ForeignKey(
- name: "FK_ApplicationRoleApplicationUser_AspNetRoles_UserRolesId",
- column: x => x.UserRolesId,
- principalTable: "AspNetRoles",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_ApplicationRoleApplicationUser_AspNetUsers_UsersId",
- column: x => x.UsersId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
- migrationBuilder.CreateTable(
- name: "AspNetUserClaims",
- columns: table => new
- {
- Id = table.Column<int>(type: "int", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
- ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
- ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
- table.ForeignKey(
- name: "FK_AspNetUserClaims_AspNetUsers_UserId",
- column: x => x.UserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
- migrationBuilder.CreateTable(
- name: "AspNetUserLogins",
- columns: table => new
- {
- LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false),
- ProviderKey = table.Column<string>(type: "nvarchar(450)", nullable: false),
- ProviderDisplayName = table.Column<string>(type: "nvarchar(max)", nullable: true),
- UserId = table.Column<string>(type: "nvarchar(450)", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
- table.ForeignKey(
- name: "FK_AspNetUserLogins_AspNetUsers_UserId",
- column: x => x.UserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
- migrationBuilder.CreateTable(
- name: "AspNetUserRoles",
- columns: table => new
- {
- UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
- RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
- table.ForeignKey(
- name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
- column: x => x.RoleId,
- principalTable: "AspNetRoles",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_AspNetUserRoles_AspNetUsers_UserId",
- column: x => x.UserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
- migrationBuilder.CreateTable(
- name: "AspNetUserTokens",
- columns: table => new
- {
- UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
- LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false),
- Name = table.Column<string>(type: "nvarchar(450)", nullable: false),
- Value = table.Column<string>(type: "nvarchar(max)", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
- table.ForeignKey(
- name: "FK_AspNetUserTokens_AspNetUsers_UserId",
- column: x => x.UserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
- 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.CreateTable(
- name: "RolePermissions",
- columns: table => new
- {
- Id = table.Column<long>(type: "bigint", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false),
- PermissionId = table.Column<long>(type: "bigint", nullable: false),
- PermissionName = table.Column<string>(type: "nvarchar(max)", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_RolePermissions", x => x.Id);
- table.ForeignKey(
- name: "FK_RolePermissions_AspNetRoles_RoleId",
- column: x => x.RoleId,
- principalTable: "AspNetRoles",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_RolePermissions_Permissions_PermissionId",
- column: x => x.PermissionId,
- principalTable: "Permissions",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
- migrationBuilder.CreateTable(
- name: "UserTasks",
- 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),
- IsDeleted = table.Column<bool>(type: "bit", nullable: false),
- DeleteUserId = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
- AssignedUserId = table.Column<long>(type: "bigint", nullable: false),
- Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
- Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
- DueDate = table.Column<DateTime>(type: "datetime2", nullable: false),
- Priority = table.Column<int>(type: "int", nullable: false),
- ProjectId = table.Column<long>(type: "bigint", nullable: false),
- StatusId = table.Column<long>(type: "bigint", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_UserTasks", x => x.Id);
- table.ForeignKey(
- name: "FK_UserTasks_Projects_ProjectId",
- column: x => x.ProjectId,
- principalTable: "Projects",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_UserTasks_UserTaskStatuses_StatusId",
- column: x => x.StatusId,
- principalTable: "UserTaskStatuses",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
- migrationBuilder.CreateTable(
- name: "UserTaskAttachments",
- 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),
- TaskId = table.Column<long>(type: "bigint", 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_UserTaskAttachments", x => x.Id);
- table.ForeignKey(
- name: "FK_UserTaskAttachments_AttachmentTypes_AttachmentTypeId",
- column: x => x.AttachmentTypeId,
- principalTable: "AttachmentTypes",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_UserTaskAttachments_UserTasks_TaskId",
- column: x => x.TaskId,
- principalTable: "UserTasks",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
- migrationBuilder.CreateTable(
- name: "UserTaskHistories",
- 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),
- AssignedToUserId = table.Column<long>(type: "bigint", nullable: false),
- Comment = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
- CurrentStatusId = table.Column<long>(type: "bigint", nullable: false),
- IsDeleted = table.Column<bool>(type: "bit", nullable: false),
- UserTaskId = table.Column<long>(type: "bigint", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_UserTaskHistories", x => x.Id);
- table.ForeignKey(
- name: "FK_UserTaskHistories_UserTaskStatuses_CurrentStatusId",
- column: x => x.CurrentStatusId,
- principalTable: "UserTaskStatuses",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_UserTaskHistories_UserTasks_UserTaskId",
- column: x => x.UserTaskId,
- principalTable: "UserTasks",
- principalColumn: "Id");
- });
- migrationBuilder.InsertData(
- table: "AspNetRoles",
- columns: new[] { "Id", "ConcurrencyStamp", "CreateDate", "CreateUser", "DeleteUserId", "IsAdmin", "IsDeleted", "Name", "NormalizedName", "UpdateDate", "UpdateUser" },
- values: new object[,]
- {
- { "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211A", null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), null, null, true, false, "Admin", "ADMIN", null, null },
- { "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211E", null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), null, null, false, false, "Employee", "EMPLOYEE", null, null }
- });
- migrationBuilder.InsertData(
- table: "AspNetUsers",
- columns: new[] { "Id", "AccessFailedCount", "ConcurrencyStamp", "CreateUser", "DeleteUserId", "Email", "EmailConfirmed", "FavoriteName", "FirstName", "IncomeTaxValue", "IsDeleted", "IsStopped", "JobTitle", "LastName", "LockoutEnabled", "LockoutEnd", "ManagerId", "NormalizedEmail", "NormalizedUserName", "PassportNumber", "PasswordHash", "PhoneNumber", "PhoneNumberConfirmed", "QualificationId", "SecurityStamp", "TaxNumber", "TwoFactorEnabled", "University", "UpdateUser", "UserName", "UserType" },
- values: new object[,]
- {
- { "ADMB3B92-2311-48F8-9DEC-F9FAEF1F21UA", 0, "7cc87689-9eab-4280-b8e3-1834080783a5", null, null, "a@b.com", true, null, "Zinab", 1m, false, false, null, "Elgendy", false, null, null, "A@B.COM", "ADMIN", "1234567", "AQAAAAIAAYagAAAAEPg+ASbciPFxtyxQq8Wx5ilBUQ0RbAoITXXkOQm1PzC5BzySX0sn/wUmOjBKPDGV9w==", "1234567890", true, 1, "49bb16c3-4704-4c60-908d-dc8506950acc", 111m, false, null, null, "Admin", 1 },
- { "AL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB", 0, "4af7b4cf-802a-455b-b598-997e167745b3", null, null, "ali@b.com", true, null, "Ali", 100m, false, false, null, "Farok", false, null, null, "ALI@B.COM", "ALI", "7654321001010", "AQAAAAIAAYagAAAAEI3QJkcZjCH4Y8Db4rEgL8Mmll5oCvYcWiXZjQSN9bGW4SMcjHe3ZPMnkN/l9DmJeQ==", "1234567890", true, 1, "62549056-1b9d-46d4-84f8-adea3e4d8b68", 222m, false, null, null, "ali", 1 }
- });
- migrationBuilder.InsertData(
- table: "AttachmentTypes",
- columns: new[] { "Id", "IsRequired", "NameAr", "NameEn" },
- values: new object[,]
- {
- { 1L, false, "السيرة الذاتية", "CV" },
- { 2L, false, "الهوية", "Identification" }
- });
- migrationBuilder.InsertData(
- table: "AspNetUserRoles",
- columns: new[] { "RoleId", "UserId" },
- values: new object[,]
- {
- { "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211A", "ADMB3B92-2311-48F8-9DEC-F9FAEF1F21UA" },
- { "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211E", "AL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB" }
- });
- migrationBuilder.CreateIndex(
- name: "IX_ApplicationRoleApplicationUser_UsersId",
- table: "ApplicationRoleApplicationUser",
- column: "UsersId");
- migrationBuilder.CreateIndex(
- name: "IX_AspNetRoleClaims_RoleId",
- table: "AspNetRoleClaims",
- column: "RoleId");
- migrationBuilder.CreateIndex(
- name: "RoleNameIndex",
- table: "AspNetRoles",
- column: "NormalizedName",
- unique: true,
- filter: "[NormalizedName] IS NOT NULL");
- migrationBuilder.CreateIndex(
- name: "IX_AspNetUserClaims_UserId",
- table: "AspNetUserClaims",
- column: "UserId");
- migrationBuilder.CreateIndex(
- name: "IX_AspNetUserLogins_UserId",
- table: "AspNetUserLogins",
- column: "UserId");
- migrationBuilder.CreateIndex(
- name: "IX_AspNetUserRoles_RoleId",
- table: "AspNetUserRoles",
- column: "RoleId");
- migrationBuilder.CreateIndex(
- name: "EmailIndex",
- table: "AspNetUsers",
- column: "NormalizedEmail");
- migrationBuilder.CreateIndex(
- name: "IX_AspNetUsers_ManagerId",
- table: "AspNetUsers",
- column: "ManagerId");
- migrationBuilder.CreateIndex(
- name: "UserNameIndex",
- table: "AspNetUsers",
- column: "NormalizedUserName",
- unique: true,
- filter: "[NormalizedUserName] IS NOT NULL");
- migrationBuilder.CreateIndex(
- name: "IX_RolePermissions_PermissionId",
- table: "RolePermissions",
- column: "PermissionId");
- migrationBuilder.CreateIndex(
- name: "IX_RolePermissions_RoleId",
- table: "RolePermissions",
- column: "RoleId");
- 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");
- migrationBuilder.CreateIndex(
- name: "IX_UserTaskAttachments_AttachmentTypeId",
- table: "UserTaskAttachments",
- column: "AttachmentTypeId");
- migrationBuilder.CreateIndex(
- name: "IX_UserTaskAttachments_TaskId",
- table: "UserTaskAttachments",
- column: "TaskId");
- migrationBuilder.CreateIndex(
- name: "IX_UserTaskHistories_CurrentStatusId",
- table: "UserTaskHistories",
- column: "CurrentStatusId");
- migrationBuilder.CreateIndex(
- name: "IX_UserTaskHistories_UserTaskId",
- table: "UserTaskHistories",
- column: "UserTaskId");
- migrationBuilder.CreateIndex(
- name: "IX_UserTasks_ProjectId",
- table: "UserTasks",
- column: "ProjectId");
- migrationBuilder.CreateIndex(
- name: "IX_UserTasks_StatusId",
- table: "UserTasks",
- column: "StatusId");
- }
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "ApplicationRoleApplicationUser");
- migrationBuilder.DropTable(
- name: "AspNetRoleClaims");
- migrationBuilder.DropTable(
- name: "AspNetUserClaims");
- migrationBuilder.DropTable(
- name: "AspNetUserLogins");
- migrationBuilder.DropTable(
- name: "AspNetUserRoles");
- migrationBuilder.DropTable(
- name: "AspNetUserTokens");
- migrationBuilder.DropTable(
- name: "AuthLogs");
- migrationBuilder.DropTable(
- name: "Companies");
- migrationBuilder.DropTable(
- name: "FileLogs");
- migrationBuilder.DropTable(
- name: "RoleLogs");
- migrationBuilder.DropTable(
- name: "RolePermissions");
- migrationBuilder.DropTable(
- name: "SettingLogs");
- migrationBuilder.DropTable(
- name: "UserAddress");
- migrationBuilder.DropTable(
- name: "UserAttachments");
- migrationBuilder.DropTable(
- name: "UserLogs");
- migrationBuilder.DropTable(
- name: "UserTaskAttachments");
- migrationBuilder.DropTable(
- name: "UserTaskHistories");
- migrationBuilder.DropTable(
- name: "AspNetRoles");
- migrationBuilder.DropTable(
- name: "Permissions");
- migrationBuilder.DropTable(
- name: "AspNetUsers");
- migrationBuilder.DropTable(
- name: "AttachmentTypes");
- migrationBuilder.DropTable(
- name: "UserTasks");
- migrationBuilder.DropTable(
- name: "Projects");
- migrationBuilder.DropTable(
- name: "UserTaskStatuses");
- }
- }
- }
|