20240228105352_initial.cs 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. #pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
  5. namespace MTWorkHR.Infrastructure.Migrations
  6. {
  7. /// <inheritdoc />
  8. public partial class initial : 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. CreateUser = table.Column<string>(type: "nvarchar(max)", nullable: true),
  19. UpdateUser = table.Column<string>(type: "nvarchar(max)", nullable: true),
  20. CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
  21. UpdateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
  22. IsDeleted = table.Column<bool>(type: "bit", nullable: false),
  23. DeleteUserId = table.Column<string>(type: "nvarchar(max)", nullable: true),
  24. IsAdmin = table.Column<bool>(type: "bit", nullable: true),
  25. Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  26. NormalizedName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  27. ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true)
  28. },
  29. constraints: table =>
  30. {
  31. table.PrimaryKey("PK_AspNetRoles", x => x.Id);
  32. });
  33. migrationBuilder.CreateTable(
  34. name: "AspNetUsers",
  35. columns: table => new
  36. {
  37. Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
  38. FirstName = table.Column<string>(type: "nvarchar(max)", nullable: false),
  39. LastName = table.Column<string>(type: "nvarchar(max)", nullable: false),
  40. UserType = table.Column<int>(type: "int", nullable: false),
  41. FavoriteName = table.Column<string>(type: "nvarchar(max)", nullable: true),
  42. PassportNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
  43. QualificationId = table.Column<int>(type: "int", nullable: true),
  44. University = table.Column<string>(type: "nvarchar(max)", nullable: true),
  45. JobTitle = table.Column<string>(type: "nvarchar(max)", nullable: true),
  46. ManagerId = table.Column<string>(type: "nvarchar(450)", nullable: true),
  47. TaxNumber = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
  48. IncomeTaxValue = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
  49. CreateUser = table.Column<string>(type: "nvarchar(max)", nullable: true),
  50. UpdateUser = table.Column<string>(type: "nvarchar(max)", nullable: true),
  51. IsStopped = table.Column<bool>(type: "bit", nullable: false),
  52. IsDeleted = table.Column<bool>(type: "bit", nullable: false),
  53. DeleteUserId = table.Column<string>(type: "nvarchar(max)", nullable: true),
  54. UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  55. NormalizedUserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  56. Email = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  57. NormalizedEmail = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  58. EmailConfirmed = table.Column<bool>(type: "bit", nullable: false),
  59. PasswordHash = table.Column<string>(type: "nvarchar(max)", nullable: true),
  60. SecurityStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
  61. ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
  62. PhoneNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
  63. PhoneNumberConfirmed = table.Column<bool>(type: "bit", nullable: false),
  64. TwoFactorEnabled = table.Column<bool>(type: "bit", nullable: false),
  65. LockoutEnd = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
  66. LockoutEnabled = table.Column<bool>(type: "bit", nullable: false),
  67. AccessFailedCount = table.Column<int>(type: "int", nullable: false)
  68. },
  69. constraints: table =>
  70. {
  71. table.PrimaryKey("PK_AspNetUsers", x => x.Id);
  72. table.ForeignKey(
  73. name: "FK_AspNetUsers_AspNetUsers_ManagerId",
  74. column: x => x.ManagerId,
  75. principalTable: "AspNetUsers",
  76. principalColumn: "Id");
  77. });
  78. migrationBuilder.CreateTable(
  79. name: "AttachmentTypes",
  80. columns: table => new
  81. {
  82. Id = table.Column<long>(type: "bigint", nullable: false)
  83. .Annotation("SqlServer:Identity", "1, 1"),
  84. NameAr = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
  85. NameEn = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
  86. IsRequired = table.Column<bool>(type: "bit", nullable: false)
  87. },
  88. constraints: table =>
  89. {
  90. table.PrimaryKey("PK_AttachmentTypes", x => x.Id);
  91. });
  92. migrationBuilder.CreateTable(
  93. name: "AuthLogs",
  94. columns: table => new
  95. {
  96. Id = table.Column<long>(type: "bigint", nullable: false)
  97. .Annotation("SqlServer:Identity", "1, 1"),
  98. Method = table.Column<string>(type: "nvarchar(max)", nullable: false),
  99. QueryString = table.Column<string>(type: "nvarchar(max)", nullable: true),
  100. Input = table.Column<string>(type: "nvarchar(max)", nullable: true),
  101. CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
  102. CreateUser = table.Column<string>(type: "nvarchar(max)", nullable: false),
  103. ServerIP = table.Column<string>(type: "nvarchar(max)", nullable: true),
  104. Channel = table.Column<string>(type: "nvarchar(max)", nullable: true),
  105. UserIP = table.Column<string>(type: "nvarchar(max)", nullable: true),
  106. ServiceResponseTimeInSeconds = table.Column<string>(type: "nvarchar(max)", nullable: false),
  107. ErrorCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
  108. ErrorDescription = table.Column<string>(type: "nvarchar(max)", nullable: false),
  109. InnerException = table.Column<string>(type: "nvarchar(max)", nullable: true),
  110. userAgent = table.Column<string>(type: "nvarchar(max)", nullable: true)
  111. },
  112. constraints: table =>
  113. {
  114. table.PrimaryKey("PK_AuthLogs", x => x.Id);
  115. });
  116. migrationBuilder.CreateTable(
  117. name: "Companies",
  118. columns: table => new
  119. {
  120. Id = table.Column<long>(type: "bigint", nullable: false)
  121. .Annotation("SqlServer:Identity", "1, 1"),
  122. CreateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  123. UpdateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  124. CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
  125. UpdateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
  126. UserId = table.Column<long>(type: "bigint", nullable: false),
  127. CompanyName = table.Column<string>(type: "nvarchar(max)", nullable: false),
  128. CRNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
  129. TaxNumber = table.Column<int>(type: "int", nullable: false),
  130. IsDeleted = table.Column<bool>(type: "bit", nullable: false)
  131. },
  132. constraints: table =>
  133. {
  134. table.PrimaryKey("PK_Companies", x => x.Id);
  135. });
  136. migrationBuilder.CreateTable(
  137. name: "FileLogs",
  138. columns: table => new
  139. {
  140. Id = table.Column<long>(type: "bigint", nullable: false)
  141. .Annotation("SqlServer:Identity", "1, 1"),
  142. Method = table.Column<string>(type: "nvarchar(max)", nullable: false),
  143. QueryString = table.Column<string>(type: "nvarchar(max)", nullable: true),
  144. Input = table.Column<string>(type: "nvarchar(max)", nullable: true),
  145. CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
  146. CreateUser = table.Column<string>(type: "nvarchar(max)", nullable: false),
  147. ServerIP = table.Column<string>(type: "nvarchar(max)", nullable: true),
  148. Channel = table.Column<string>(type: "nvarchar(max)", nullable: true),
  149. UserIP = table.Column<string>(type: "nvarchar(max)", nullable: true),
  150. ServiceResponseTimeInSeconds = table.Column<string>(type: "nvarchar(max)", nullable: false),
  151. ErrorCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
  152. ErrorDescription = table.Column<string>(type: "nvarchar(max)", nullable: false),
  153. InnerException = table.Column<string>(type: "nvarchar(max)", nullable: true),
  154. userAgent = table.Column<string>(type: "nvarchar(max)", nullable: true)
  155. },
  156. constraints: table =>
  157. {
  158. table.PrimaryKey("PK_FileLogs", x => x.Id);
  159. });
  160. migrationBuilder.CreateTable(
  161. name: "Permissions",
  162. columns: table => new
  163. {
  164. Id = table.Column<long>(type: "bigint", nullable: false)
  165. .Annotation("SqlServer:Identity", "1, 1"),
  166. Name = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
  167. CategoryName = table.Column<string>(type: "nvarchar(150)", maxLength: 150, nullable: false),
  168. Desc = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
  169. Show = table.Column<bool>(type: "bit", nullable: false)
  170. },
  171. constraints: table =>
  172. {
  173. table.PrimaryKey("PK_Permissions", x => x.Id);
  174. });
  175. migrationBuilder.CreateTable(
  176. name: "Projects",
  177. columns: table => new
  178. {
  179. Id = table.Column<long>(type: "bigint", nullable: false)
  180. .Annotation("SqlServer:Identity", "1, 1"),
  181. NameAr = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
  182. NameEn = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false)
  183. },
  184. constraints: table =>
  185. {
  186. table.PrimaryKey("PK_Projects", x => x.Id);
  187. });
  188. migrationBuilder.CreateTable(
  189. name: "RoleLogs",
  190. columns: table => new
  191. {
  192. Id = table.Column<long>(type: "bigint", nullable: false)
  193. .Annotation("SqlServer:Identity", "1, 1"),
  194. Method = table.Column<string>(type: "nvarchar(max)", nullable: false),
  195. QueryString = table.Column<string>(type: "nvarchar(max)", nullable: true),
  196. Input = table.Column<string>(type: "nvarchar(max)", nullable: true),
  197. CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
  198. CreateUser = table.Column<string>(type: "nvarchar(max)", nullable: false),
  199. ServerIP = table.Column<string>(type: "nvarchar(max)", nullable: true),
  200. Channel = table.Column<string>(type: "nvarchar(max)", nullable: true),
  201. UserIP = table.Column<string>(type: "nvarchar(max)", nullable: true),
  202. ServiceResponseTimeInSeconds = table.Column<string>(type: "nvarchar(max)", nullable: false),
  203. ErrorCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
  204. ErrorDescription = table.Column<string>(type: "nvarchar(max)", nullable: false),
  205. InnerException = table.Column<string>(type: "nvarchar(max)", nullable: true),
  206. userAgent = table.Column<string>(type: "nvarchar(max)", nullable: true)
  207. },
  208. constraints: table =>
  209. {
  210. table.PrimaryKey("PK_RoleLogs", x => x.Id);
  211. });
  212. migrationBuilder.CreateTable(
  213. name: "SettingLogs",
  214. columns: table => new
  215. {
  216. Id = table.Column<long>(type: "bigint", nullable: false)
  217. .Annotation("SqlServer:Identity", "1, 1"),
  218. Method = table.Column<string>(type: "nvarchar(max)", nullable: false),
  219. QueryString = table.Column<string>(type: "nvarchar(max)", nullable: true),
  220. Input = table.Column<string>(type: "nvarchar(max)", nullable: true),
  221. CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
  222. CreateUser = table.Column<string>(type: "nvarchar(max)", nullable: false),
  223. ServerIP = table.Column<string>(type: "nvarchar(max)", nullable: true),
  224. Channel = table.Column<string>(type: "nvarchar(max)", nullable: true),
  225. UserIP = table.Column<string>(type: "nvarchar(max)", nullable: true),
  226. ServiceResponseTimeInSeconds = table.Column<string>(type: "nvarchar(max)", nullable: false),
  227. ErrorCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
  228. ErrorDescription = table.Column<string>(type: "nvarchar(max)", nullable: false),
  229. InnerException = table.Column<string>(type: "nvarchar(max)", nullable: true),
  230. userAgent = table.Column<string>(type: "nvarchar(max)", nullable: true)
  231. },
  232. constraints: table =>
  233. {
  234. table.PrimaryKey("PK_SettingLogs", x => x.Id);
  235. });
  236. migrationBuilder.CreateTable(
  237. name: "UserLogs",
  238. columns: table => new
  239. {
  240. Id = table.Column<long>(type: "bigint", nullable: false)
  241. .Annotation("SqlServer:Identity", "1, 1"),
  242. Method = table.Column<string>(type: "nvarchar(max)", nullable: false),
  243. QueryString = table.Column<string>(type: "nvarchar(max)", nullable: true),
  244. Input = table.Column<string>(type: "nvarchar(max)", nullable: true),
  245. CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
  246. CreateUser = table.Column<string>(type: "nvarchar(max)", nullable: false),
  247. ServerIP = table.Column<string>(type: "nvarchar(max)", nullable: true),
  248. Channel = table.Column<string>(type: "nvarchar(max)", nullable: true),
  249. UserIP = table.Column<string>(type: "nvarchar(max)", nullable: true),
  250. ServiceResponseTimeInSeconds = table.Column<string>(type: "nvarchar(max)", nullable: false),
  251. ErrorCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
  252. ErrorDescription = table.Column<string>(type: "nvarchar(max)", nullable: false),
  253. InnerException = table.Column<string>(type: "nvarchar(max)", nullable: true),
  254. userAgent = table.Column<string>(type: "nvarchar(max)", nullable: true)
  255. },
  256. constraints: table =>
  257. {
  258. table.PrimaryKey("PK_UserLogs", x => x.Id);
  259. });
  260. migrationBuilder.CreateTable(
  261. name: "UserTaskStatuses",
  262. columns: table => new
  263. {
  264. Id = table.Column<long>(type: "bigint", nullable: false)
  265. .Annotation("SqlServer:Identity", "1, 1"),
  266. NameAr = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
  267. NameEn = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false)
  268. },
  269. constraints: table =>
  270. {
  271. table.PrimaryKey("PK_UserTaskStatuses", x => x.Id);
  272. });
  273. migrationBuilder.CreateTable(
  274. name: "AspNetRoleClaims",
  275. columns: table => new
  276. {
  277. Id = table.Column<int>(type: "int", nullable: false)
  278. .Annotation("SqlServer:Identity", "1, 1"),
  279. RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false),
  280. ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
  281. ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
  282. },
  283. constraints: table =>
  284. {
  285. table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
  286. table.ForeignKey(
  287. name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
  288. column: x => x.RoleId,
  289. principalTable: "AspNetRoles",
  290. principalColumn: "Id",
  291. onDelete: ReferentialAction.Cascade);
  292. });
  293. migrationBuilder.CreateTable(
  294. name: "ApplicationRoleApplicationUser",
  295. columns: table => new
  296. {
  297. UserRolesId = table.Column<string>(type: "nvarchar(450)", nullable: false),
  298. UsersId = table.Column<string>(type: "nvarchar(450)", nullable: false)
  299. },
  300. constraints: table =>
  301. {
  302. table.PrimaryKey("PK_ApplicationRoleApplicationUser", x => new { x.UserRolesId, x.UsersId });
  303. table.ForeignKey(
  304. name: "FK_ApplicationRoleApplicationUser_AspNetRoles_UserRolesId",
  305. column: x => x.UserRolesId,
  306. principalTable: "AspNetRoles",
  307. principalColumn: "Id",
  308. onDelete: ReferentialAction.Cascade);
  309. table.ForeignKey(
  310. name: "FK_ApplicationRoleApplicationUser_AspNetUsers_UsersId",
  311. column: x => x.UsersId,
  312. principalTable: "AspNetUsers",
  313. principalColumn: "Id",
  314. onDelete: ReferentialAction.Cascade);
  315. });
  316. migrationBuilder.CreateTable(
  317. name: "AspNetUserClaims",
  318. columns: table => new
  319. {
  320. Id = table.Column<int>(type: "int", nullable: false)
  321. .Annotation("SqlServer:Identity", "1, 1"),
  322. UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
  323. ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
  324. ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
  325. },
  326. constraints: table =>
  327. {
  328. table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
  329. table.ForeignKey(
  330. name: "FK_AspNetUserClaims_AspNetUsers_UserId",
  331. column: x => x.UserId,
  332. principalTable: "AspNetUsers",
  333. principalColumn: "Id",
  334. onDelete: ReferentialAction.Cascade);
  335. });
  336. migrationBuilder.CreateTable(
  337. name: "AspNetUserLogins",
  338. columns: table => new
  339. {
  340. LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false),
  341. ProviderKey = table.Column<string>(type: "nvarchar(450)", nullable: false),
  342. ProviderDisplayName = table.Column<string>(type: "nvarchar(max)", nullable: true),
  343. UserId = table.Column<string>(type: "nvarchar(450)", nullable: false)
  344. },
  345. constraints: table =>
  346. {
  347. table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
  348. table.ForeignKey(
  349. name: "FK_AspNetUserLogins_AspNetUsers_UserId",
  350. column: x => x.UserId,
  351. principalTable: "AspNetUsers",
  352. principalColumn: "Id",
  353. onDelete: ReferentialAction.Cascade);
  354. });
  355. migrationBuilder.CreateTable(
  356. name: "AspNetUserRoles",
  357. columns: table => new
  358. {
  359. UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
  360. RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false)
  361. },
  362. constraints: table =>
  363. {
  364. table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
  365. table.ForeignKey(
  366. name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
  367. column: x => x.RoleId,
  368. principalTable: "AspNetRoles",
  369. principalColumn: "Id",
  370. onDelete: ReferentialAction.Cascade);
  371. table.ForeignKey(
  372. name: "FK_AspNetUserRoles_AspNetUsers_UserId",
  373. column: x => x.UserId,
  374. principalTable: "AspNetUsers",
  375. principalColumn: "Id",
  376. onDelete: ReferentialAction.Cascade);
  377. });
  378. migrationBuilder.CreateTable(
  379. name: "AspNetUserTokens",
  380. columns: table => new
  381. {
  382. UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
  383. LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false),
  384. Name = table.Column<string>(type: "nvarchar(450)", nullable: false),
  385. Value = table.Column<string>(type: "nvarchar(max)", nullable: true)
  386. },
  387. constraints: table =>
  388. {
  389. table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
  390. table.ForeignKey(
  391. name: "FK_AspNetUserTokens_AspNetUsers_UserId",
  392. column: x => x.UserId,
  393. principalTable: "AspNetUsers",
  394. principalColumn: "Id",
  395. onDelete: ReferentialAction.Cascade);
  396. });
  397. migrationBuilder.CreateTable(
  398. name: "UserAddress",
  399. columns: table => new
  400. {
  401. Id = table.Column<long>(type: "bigint", nullable: false)
  402. .Annotation("SqlServer:Identity", "1, 1"),
  403. CreateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  404. UpdateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  405. CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
  406. UpdateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
  407. UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
  408. CountryId = table.Column<int>(type: "int", nullable: false),
  409. City = table.Column<string>(type: "nvarchar(max)", nullable: false),
  410. PostalCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
  411. AddressDesc = table.Column<string>(type: "nvarchar(max)", nullable: false)
  412. },
  413. constraints: table =>
  414. {
  415. table.PrimaryKey("PK_UserAddress", x => x.Id);
  416. table.ForeignKey(
  417. name: "FK_UserAddress_AspNetUsers_UserId",
  418. column: x => x.UserId,
  419. principalTable: "AspNetUsers",
  420. principalColumn: "Id",
  421. onDelete: ReferentialAction.Cascade);
  422. });
  423. migrationBuilder.CreateTable(
  424. name: "UserAttachments",
  425. columns: table => new
  426. {
  427. Id = table.Column<long>(type: "bigint", nullable: false)
  428. .Annotation("SqlServer:Identity", "1, 1"),
  429. CreateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  430. UpdateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  431. CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
  432. UpdateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
  433. UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
  434. AttachmentTypeId = table.Column<long>(type: "bigint", nullable: false),
  435. FileName = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
  436. OriginalName = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false)
  437. },
  438. constraints: table =>
  439. {
  440. table.PrimaryKey("PK_UserAttachments", x => x.Id);
  441. table.ForeignKey(
  442. name: "FK_UserAttachments_AspNetUsers_UserId",
  443. column: x => x.UserId,
  444. principalTable: "AspNetUsers",
  445. principalColumn: "Id",
  446. onDelete: ReferentialAction.Cascade);
  447. table.ForeignKey(
  448. name: "FK_UserAttachments_AttachmentTypes_AttachmentTypeId",
  449. column: x => x.AttachmentTypeId,
  450. principalTable: "AttachmentTypes",
  451. principalColumn: "Id",
  452. onDelete: ReferentialAction.Cascade);
  453. });
  454. migrationBuilder.CreateTable(
  455. name: "RolePermissions",
  456. columns: table => new
  457. {
  458. Id = table.Column<long>(type: "bigint", nullable: false)
  459. .Annotation("SqlServer:Identity", "1, 1"),
  460. RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false),
  461. PermissionId = table.Column<long>(type: "bigint", nullable: false),
  462. PermissionName = table.Column<string>(type: "nvarchar(max)", nullable: false)
  463. },
  464. constraints: table =>
  465. {
  466. table.PrimaryKey("PK_RolePermissions", x => x.Id);
  467. table.ForeignKey(
  468. name: "FK_RolePermissions_AspNetRoles_RoleId",
  469. column: x => x.RoleId,
  470. principalTable: "AspNetRoles",
  471. principalColumn: "Id",
  472. onDelete: ReferentialAction.Cascade);
  473. table.ForeignKey(
  474. name: "FK_RolePermissions_Permissions_PermissionId",
  475. column: x => x.PermissionId,
  476. principalTable: "Permissions",
  477. principalColumn: "Id",
  478. onDelete: ReferentialAction.Cascade);
  479. });
  480. migrationBuilder.CreateTable(
  481. name: "UserTasks",
  482. columns: table => new
  483. {
  484. Id = table.Column<long>(type: "bigint", nullable: false)
  485. .Annotation("SqlServer:Identity", "1, 1"),
  486. CreateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  487. UpdateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  488. CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
  489. UpdateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
  490. IsDeleted = table.Column<bool>(type: "bit", nullable: false),
  491. DeleteUserId = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  492. AssignedUserId = table.Column<long>(type: "bigint", nullable: false),
  493. Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
  494. Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
  495. DueDate = table.Column<DateTime>(type: "datetime2", nullable: false),
  496. Priority = table.Column<int>(type: "int", nullable: false),
  497. ProjectId = table.Column<long>(type: "bigint", nullable: false),
  498. StatusId = table.Column<long>(type: "bigint", nullable: false)
  499. },
  500. constraints: table =>
  501. {
  502. table.PrimaryKey("PK_UserTasks", x => x.Id);
  503. table.ForeignKey(
  504. name: "FK_UserTasks_Projects_ProjectId",
  505. column: x => x.ProjectId,
  506. principalTable: "Projects",
  507. principalColumn: "Id",
  508. onDelete: ReferentialAction.Cascade);
  509. table.ForeignKey(
  510. name: "FK_UserTasks_UserTaskStatuses_StatusId",
  511. column: x => x.StatusId,
  512. principalTable: "UserTaskStatuses",
  513. principalColumn: "Id",
  514. onDelete: ReferentialAction.Cascade);
  515. });
  516. migrationBuilder.CreateTable(
  517. name: "UserTaskAttachments",
  518. columns: table => new
  519. {
  520. Id = table.Column<long>(type: "bigint", nullable: false)
  521. .Annotation("SqlServer:Identity", "1, 1"),
  522. CreateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  523. UpdateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  524. CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
  525. UpdateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
  526. TaskId = table.Column<long>(type: "bigint", nullable: false),
  527. AttachmentTypeId = table.Column<long>(type: "bigint", nullable: false),
  528. FileName = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
  529. OriginalName = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false)
  530. },
  531. constraints: table =>
  532. {
  533. table.PrimaryKey("PK_UserTaskAttachments", x => x.Id);
  534. table.ForeignKey(
  535. name: "FK_UserTaskAttachments_AttachmentTypes_AttachmentTypeId",
  536. column: x => x.AttachmentTypeId,
  537. principalTable: "AttachmentTypes",
  538. principalColumn: "Id",
  539. onDelete: ReferentialAction.Cascade);
  540. table.ForeignKey(
  541. name: "FK_UserTaskAttachments_UserTasks_TaskId",
  542. column: x => x.TaskId,
  543. principalTable: "UserTasks",
  544. principalColumn: "Id",
  545. onDelete: ReferentialAction.Cascade);
  546. });
  547. migrationBuilder.CreateTable(
  548. name: "UserTaskHistories",
  549. columns: table => new
  550. {
  551. Id = table.Column<long>(type: "bigint", nullable: false)
  552. .Annotation("SqlServer:Identity", "1, 1"),
  553. CreateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  554. UpdateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
  555. CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
  556. UpdateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
  557. AssignedToUserId = table.Column<long>(type: "bigint", nullable: false),
  558. Comment = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
  559. CurrentStatusId = table.Column<long>(type: "bigint", nullable: false),
  560. IsDeleted = table.Column<bool>(type: "bit", nullable: false),
  561. UserTaskId = table.Column<long>(type: "bigint", nullable: true)
  562. },
  563. constraints: table =>
  564. {
  565. table.PrimaryKey("PK_UserTaskHistories", x => x.Id);
  566. table.ForeignKey(
  567. name: "FK_UserTaskHistories_UserTaskStatuses_CurrentStatusId",
  568. column: x => x.CurrentStatusId,
  569. principalTable: "UserTaskStatuses",
  570. principalColumn: "Id",
  571. onDelete: ReferentialAction.Cascade);
  572. table.ForeignKey(
  573. name: "FK_UserTaskHistories_UserTasks_UserTaskId",
  574. column: x => x.UserTaskId,
  575. principalTable: "UserTasks",
  576. principalColumn: "Id");
  577. });
  578. migrationBuilder.InsertData(
  579. table: "AspNetRoles",
  580. columns: new[] { "Id", "ConcurrencyStamp", "CreateDate", "CreateUser", "DeleteUserId", "IsAdmin", "IsDeleted", "Name", "NormalizedName", "UpdateDate", "UpdateUser" },
  581. values: new object[,]
  582. {
  583. { "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 },
  584. { "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 }
  585. });
  586. migrationBuilder.InsertData(
  587. table: "AspNetUsers",
  588. 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" },
  589. values: new object[,]
  590. {
  591. { "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 },
  592. { "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 }
  593. });
  594. migrationBuilder.InsertData(
  595. table: "AttachmentTypes",
  596. columns: new[] { "Id", "IsRequired", "NameAr", "NameEn" },
  597. values: new object[,]
  598. {
  599. { 1L, false, "السيرة الذاتية", "CV" },
  600. { 2L, false, "الهوية", "Identification" }
  601. });
  602. migrationBuilder.InsertData(
  603. table: "AspNetUserRoles",
  604. columns: new[] { "RoleId", "UserId" },
  605. values: new object[,]
  606. {
  607. { "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211A", "ADMB3B92-2311-48F8-9DEC-F9FAEF1F21UA" },
  608. { "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211E", "AL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB" }
  609. });
  610. migrationBuilder.CreateIndex(
  611. name: "IX_ApplicationRoleApplicationUser_UsersId",
  612. table: "ApplicationRoleApplicationUser",
  613. column: "UsersId");
  614. migrationBuilder.CreateIndex(
  615. name: "IX_AspNetRoleClaims_RoleId",
  616. table: "AspNetRoleClaims",
  617. column: "RoleId");
  618. migrationBuilder.CreateIndex(
  619. name: "RoleNameIndex",
  620. table: "AspNetRoles",
  621. column: "NormalizedName",
  622. unique: true,
  623. filter: "[NormalizedName] IS NOT NULL");
  624. migrationBuilder.CreateIndex(
  625. name: "IX_AspNetUserClaims_UserId",
  626. table: "AspNetUserClaims",
  627. column: "UserId");
  628. migrationBuilder.CreateIndex(
  629. name: "IX_AspNetUserLogins_UserId",
  630. table: "AspNetUserLogins",
  631. column: "UserId");
  632. migrationBuilder.CreateIndex(
  633. name: "IX_AspNetUserRoles_RoleId",
  634. table: "AspNetUserRoles",
  635. column: "RoleId");
  636. migrationBuilder.CreateIndex(
  637. name: "EmailIndex",
  638. table: "AspNetUsers",
  639. column: "NormalizedEmail");
  640. migrationBuilder.CreateIndex(
  641. name: "IX_AspNetUsers_ManagerId",
  642. table: "AspNetUsers",
  643. column: "ManagerId");
  644. migrationBuilder.CreateIndex(
  645. name: "UserNameIndex",
  646. table: "AspNetUsers",
  647. column: "NormalizedUserName",
  648. unique: true,
  649. filter: "[NormalizedUserName] IS NOT NULL");
  650. migrationBuilder.CreateIndex(
  651. name: "IX_RolePermissions_PermissionId",
  652. table: "RolePermissions",
  653. column: "PermissionId");
  654. migrationBuilder.CreateIndex(
  655. name: "IX_RolePermissions_RoleId",
  656. table: "RolePermissions",
  657. column: "RoleId");
  658. migrationBuilder.CreateIndex(
  659. name: "IX_UserAddress_UserId",
  660. table: "UserAddress",
  661. column: "UserId",
  662. unique: true);
  663. migrationBuilder.CreateIndex(
  664. name: "IX_UserAttachments_AttachmentTypeId",
  665. table: "UserAttachments",
  666. column: "AttachmentTypeId");
  667. migrationBuilder.CreateIndex(
  668. name: "IX_UserAttachments_UserId",
  669. table: "UserAttachments",
  670. column: "UserId");
  671. migrationBuilder.CreateIndex(
  672. name: "IX_UserTaskAttachments_AttachmentTypeId",
  673. table: "UserTaskAttachments",
  674. column: "AttachmentTypeId");
  675. migrationBuilder.CreateIndex(
  676. name: "IX_UserTaskAttachments_TaskId",
  677. table: "UserTaskAttachments",
  678. column: "TaskId");
  679. migrationBuilder.CreateIndex(
  680. name: "IX_UserTaskHistories_CurrentStatusId",
  681. table: "UserTaskHistories",
  682. column: "CurrentStatusId");
  683. migrationBuilder.CreateIndex(
  684. name: "IX_UserTaskHistories_UserTaskId",
  685. table: "UserTaskHistories",
  686. column: "UserTaskId");
  687. migrationBuilder.CreateIndex(
  688. name: "IX_UserTasks_ProjectId",
  689. table: "UserTasks",
  690. column: "ProjectId");
  691. migrationBuilder.CreateIndex(
  692. name: "IX_UserTasks_StatusId",
  693. table: "UserTasks",
  694. column: "StatusId");
  695. }
  696. /// <inheritdoc />
  697. protected override void Down(MigrationBuilder migrationBuilder)
  698. {
  699. migrationBuilder.DropTable(
  700. name: "ApplicationRoleApplicationUser");
  701. migrationBuilder.DropTable(
  702. name: "AspNetRoleClaims");
  703. migrationBuilder.DropTable(
  704. name: "AspNetUserClaims");
  705. migrationBuilder.DropTable(
  706. name: "AspNetUserLogins");
  707. migrationBuilder.DropTable(
  708. name: "AspNetUserRoles");
  709. migrationBuilder.DropTable(
  710. name: "AspNetUserTokens");
  711. migrationBuilder.DropTable(
  712. name: "AuthLogs");
  713. migrationBuilder.DropTable(
  714. name: "Companies");
  715. migrationBuilder.DropTable(
  716. name: "FileLogs");
  717. migrationBuilder.DropTable(
  718. name: "RoleLogs");
  719. migrationBuilder.DropTable(
  720. name: "RolePermissions");
  721. migrationBuilder.DropTable(
  722. name: "SettingLogs");
  723. migrationBuilder.DropTable(
  724. name: "UserAddress");
  725. migrationBuilder.DropTable(
  726. name: "UserAttachments");
  727. migrationBuilder.DropTable(
  728. name: "UserLogs");
  729. migrationBuilder.DropTable(
  730. name: "UserTaskAttachments");
  731. migrationBuilder.DropTable(
  732. name: "UserTaskHistories");
  733. migrationBuilder.DropTable(
  734. name: "AspNetRoles");
  735. migrationBuilder.DropTable(
  736. name: "Permissions");
  737. migrationBuilder.DropTable(
  738. name: "AspNetUsers");
  739. migrationBuilder.DropTable(
  740. name: "AttachmentTypes");
  741. migrationBuilder.DropTable(
  742. name: "UserTasks");
  743. migrationBuilder.DropTable(
  744. name: "Projects");
  745. migrationBuilder.DropTable(
  746. name: "UserTaskStatuses");
  747. }
  748. }
  749. }