20240115092554_identity.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. #pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
  5. namespace MTWorkHR.Identity.Migrations
  6. {
  7. /// <inheritdoc />
  8. public partial class identity : Migration
  9. {
  10. /// <inheritdoc />
  11. protected override void Up(MigrationBuilder migrationBuilder)
  12. {
  13. migrationBuilder.CreateTable(
  14. name: "AspNetRoles",
  15. columns: table => new
  16. {
  17. Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
  18. Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  19. NormalizedName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  20. ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true)
  21. },
  22. constraints: table =>
  23. {
  24. table.PrimaryKey("PK_AspNetRoles", x => x.Id);
  25. });
  26. migrationBuilder.CreateTable(
  27. name: "AspNetUsers",
  28. columns: table => new
  29. {
  30. Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
  31. FirstName = table.Column<string>(type: "nvarchar(max)", nullable: false),
  32. LastName = table.Column<string>(type: "nvarchar(max)", nullable: false),
  33. UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  34. NormalizedUserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  35. Email = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  36. NormalizedEmail = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  37. EmailConfirmed = table.Column<bool>(type: "bit", nullable: false),
  38. PasswordHash = table.Column<string>(type: "nvarchar(max)", nullable: true),
  39. SecurityStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
  40. ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
  41. PhoneNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
  42. PhoneNumberConfirmed = table.Column<bool>(type: "bit", nullable: false),
  43. TwoFactorEnabled = table.Column<bool>(type: "bit", nullable: false),
  44. LockoutEnd = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
  45. LockoutEnabled = table.Column<bool>(type: "bit", nullable: false),
  46. AccessFailedCount = table.Column<int>(type: "int", nullable: false)
  47. },
  48. constraints: table =>
  49. {
  50. table.PrimaryKey("PK_AspNetUsers", x => x.Id);
  51. });
  52. migrationBuilder.CreateTable(
  53. name: "AspNetRoleClaims",
  54. columns: table => new
  55. {
  56. Id = table.Column<int>(type: "int", nullable: false)
  57. .Annotation("SqlServer:Identity", "1, 1"),
  58. RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false),
  59. ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
  60. ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
  61. },
  62. constraints: table =>
  63. {
  64. table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
  65. table.ForeignKey(
  66. name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
  67. column: x => x.RoleId,
  68. principalTable: "AspNetRoles",
  69. principalColumn: "Id",
  70. onDelete: ReferentialAction.Cascade);
  71. });
  72. migrationBuilder.CreateTable(
  73. name: "AspNetUserClaims",
  74. columns: table => new
  75. {
  76. Id = table.Column<int>(type: "int", nullable: false)
  77. .Annotation("SqlServer:Identity", "1, 1"),
  78. UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
  79. ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
  80. ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
  81. },
  82. constraints: table =>
  83. {
  84. table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
  85. table.ForeignKey(
  86. name: "FK_AspNetUserClaims_AspNetUsers_UserId",
  87. column: x => x.UserId,
  88. principalTable: "AspNetUsers",
  89. principalColumn: "Id",
  90. onDelete: ReferentialAction.Cascade);
  91. });
  92. migrationBuilder.CreateTable(
  93. name: "AspNetUserLogins",
  94. columns: table => new
  95. {
  96. LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false),
  97. ProviderKey = table.Column<string>(type: "nvarchar(450)", nullable: false),
  98. ProviderDisplayName = table.Column<string>(type: "nvarchar(max)", nullable: true),
  99. UserId = table.Column<string>(type: "nvarchar(450)", nullable: false)
  100. },
  101. constraints: table =>
  102. {
  103. table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
  104. table.ForeignKey(
  105. name: "FK_AspNetUserLogins_AspNetUsers_UserId",
  106. column: x => x.UserId,
  107. principalTable: "AspNetUsers",
  108. principalColumn: "Id",
  109. onDelete: ReferentialAction.Cascade);
  110. });
  111. migrationBuilder.CreateTable(
  112. name: "AspNetUserRoles",
  113. columns: table => new
  114. {
  115. UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
  116. RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false)
  117. },
  118. constraints: table =>
  119. {
  120. table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
  121. table.ForeignKey(
  122. name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
  123. column: x => x.RoleId,
  124. principalTable: "AspNetRoles",
  125. principalColumn: "Id",
  126. onDelete: ReferentialAction.Cascade);
  127. table.ForeignKey(
  128. name: "FK_AspNetUserRoles_AspNetUsers_UserId",
  129. column: x => x.UserId,
  130. principalTable: "AspNetUsers",
  131. principalColumn: "Id",
  132. onDelete: ReferentialAction.Cascade);
  133. });
  134. migrationBuilder.CreateTable(
  135. name: "AspNetUserTokens",
  136. columns: table => new
  137. {
  138. UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
  139. LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false),
  140. Name = table.Column<string>(type: "nvarchar(450)", nullable: false),
  141. Value = table.Column<string>(type: "nvarchar(max)", nullable: true)
  142. },
  143. constraints: table =>
  144. {
  145. table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
  146. table.ForeignKey(
  147. name: "FK_AspNetUserTokens_AspNetUsers_UserId",
  148. column: x => x.UserId,
  149. principalTable: "AspNetUsers",
  150. principalColumn: "Id",
  151. onDelete: ReferentialAction.Cascade);
  152. });
  153. migrationBuilder.InsertData(
  154. table: "AspNetRoles",
  155. columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
  156. values: new object[,]
  157. {
  158. { "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211B", null, "Admin", "ADMIN" },
  159. { "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211A", null, "Employee", "EMPLOYEE" }
  160. });
  161. migrationBuilder.InsertData(
  162. table: "AspNetUsers",
  163. columns: new[] { "Id", "AccessFailedCount", "ConcurrencyStamp", "Email", "EmailConfirmed", "FirstName", "LastName", "LockoutEnabled", "LockoutEnd", "NormalizedEmail", "NormalizedUserName", "PasswordHash", "PhoneNumber", "PhoneNumberConfirmed", "SecurityStamp", "TwoFactorEnabled", "UserName" },
  164. values: new object[,]
  165. {
  166. { "AD5B3B92-2311-48F8-9DEC-F9FAEF1F21UA", 0, "d1e41737-1312-47fe-b7e9-fa9917dd94ad", "a@b.com", true, "Zinab", "Elgendy", false, null, "A@B.COM", "ADMIN", "AQAAAAIAAYagAAAAEPg+ASbciPFxtyxQq8Wx5ilBUQ0RbAoITXXkOQm1PzC5BzySX0sn/wUmOjBKPDGV9w==", "1234567890", true, "7714198f-15f6-4524-a221-b0826892516b", false, "Admin" },
  167. { "LL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB", 0, "fe634cad-b63a-4cc1-8938-4499edd22d35", "ali@b.com", true, "Ali", "Farok", false, null, "ALI@B.COM", "ALI", "AQAAAAIAAYagAAAAEI3QJkcZjCH4Y8Db4rEgL8Mmll5oCvYcWiXZjQSN9bGW4SMcjHe3ZPMnkN/l9DmJeQ==", "1234567890", true, "bba3264c-1777-4ca7-837a-2f8ed1b16d01", false, "ali" }
  168. });
  169. migrationBuilder.InsertData(
  170. table: "AspNetUserRoles",
  171. columns: new[] { "RoleId", "UserId" },
  172. values: new object[,]
  173. {
  174. { "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211B", "AD5B3B92-2311-48F8-9DEC-F9FAEF1F21UA" },
  175. { "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211A", "LL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB" }
  176. });
  177. migrationBuilder.CreateIndex(
  178. name: "IX_AspNetRoleClaims_RoleId",
  179. table: "AspNetRoleClaims",
  180. column: "RoleId");
  181. migrationBuilder.CreateIndex(
  182. name: "RoleNameIndex",
  183. table: "AspNetRoles",
  184. column: "NormalizedName",
  185. unique: true,
  186. filter: "[NormalizedName] IS NOT NULL");
  187. migrationBuilder.CreateIndex(
  188. name: "IX_AspNetUserClaims_UserId",
  189. table: "AspNetUserClaims",
  190. column: "UserId");
  191. migrationBuilder.CreateIndex(
  192. name: "IX_AspNetUserLogins_UserId",
  193. table: "AspNetUserLogins",
  194. column: "UserId");
  195. migrationBuilder.CreateIndex(
  196. name: "IX_AspNetUserRoles_RoleId",
  197. table: "AspNetUserRoles",
  198. column: "RoleId");
  199. migrationBuilder.CreateIndex(
  200. name: "EmailIndex",
  201. table: "AspNetUsers",
  202. column: "NormalizedEmail");
  203. migrationBuilder.CreateIndex(
  204. name: "UserNameIndex",
  205. table: "AspNetUsers",
  206. column: "NormalizedUserName",
  207. unique: true,
  208. filter: "[NormalizedUserName] IS NOT NULL");
  209. }
  210. /// <inheritdoc />
  211. protected override void Down(MigrationBuilder migrationBuilder)
  212. {
  213. migrationBuilder.DropTable(
  214. name: "AspNetRoleClaims");
  215. migrationBuilder.DropTable(
  216. name: "AspNetUserClaims");
  217. migrationBuilder.DropTable(
  218. name: "AspNetUserLogins");
  219. migrationBuilder.DropTable(
  220. name: "AspNetUserRoles");
  221. migrationBuilder.DropTable(
  222. name: "AspNetUserTokens");
  223. migrationBuilder.DropTable(
  224. name: "AspNetRoles");
  225. migrationBuilder.DropTable(
  226. name: "AspNetUsers");
  227. }
  228. }
  229. }