20240403151641_country.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. using Microsoft.EntityFrameworkCore.Migrations;
  2. #nullable disable
  3. namespace MTWorkHR.Infrastructure.Migrations
  4. {
  5. /// <inheritdoc />
  6. public partial class country : Migration
  7. {
  8. /// <inheritdoc />
  9. protected override void Up(MigrationBuilder migrationBuilder)
  10. {
  11. migrationBuilder.DropColumn(
  12. name: "JobTitle",
  13. table: "AspNetUsers");
  14. migrationBuilder.DropColumn(
  15. name: "University",
  16. table: "AspNetUsers");
  17. migrationBuilder.AddColumn<int>(
  18. name: "CountryId",
  19. table: "AspNetUsers",
  20. type: "int",
  21. nullable: true);
  22. migrationBuilder.AddColumn<int>(
  23. name: "IndustryId",
  24. table: "AspNetUsers",
  25. type: "int",
  26. nullable: true);
  27. migrationBuilder.AddColumn<int>(
  28. name: "JobTitleId",
  29. table: "AspNetUsers",
  30. type: "int",
  31. nullable: true);
  32. migrationBuilder.AddColumn<int>(
  33. name: "UniversityId",
  34. table: "AspNetUsers",
  35. type: "int",
  36. nullable: true);
  37. migrationBuilder.CreateTable(
  38. name: "CountryLookups",
  39. columns: table => new
  40. {
  41. Id = table.Column<long>(type: "bigint", nullable: false)
  42. .Annotation("SqlServer:Identity", "1, 1"),
  43. NameAr = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
  44. NameEn = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
  45. Code = table.Column<string>(type: "nvarchar(max)", nullable: false)
  46. },
  47. constraints: table =>
  48. {
  49. table.PrimaryKey("PK_CountryLookups", x => x.Id);
  50. });
  51. migrationBuilder.CreateTable(
  52. name: "Industries",
  53. columns: table => new
  54. {
  55. Id = table.Column<long>(type: "bigint", nullable: false)
  56. .Annotation("SqlServer:Identity", "1, 1"),
  57. NameAr = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
  58. NameEn = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false)
  59. },
  60. constraints: table =>
  61. {
  62. table.PrimaryKey("PK_Industries", x => x.Id);
  63. });
  64. migrationBuilder.CreateTable(
  65. name: "JobTitles",
  66. columns: table => new
  67. {
  68. Id = table.Column<long>(type: "bigint", nullable: false)
  69. .Annotation("SqlServer:Identity", "1, 1"),
  70. NameAr = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
  71. NameEn = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false)
  72. },
  73. constraints: table =>
  74. {
  75. table.PrimaryKey("PK_JobTitles", x => x.Id);
  76. });
  77. migrationBuilder.CreateTable(
  78. name: "Qualifications",
  79. columns: table => new
  80. {
  81. Id = table.Column<long>(type: "bigint", nullable: false)
  82. .Annotation("SqlServer:Identity", "1, 1"),
  83. NameAr = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
  84. NameEn = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false)
  85. },
  86. constraints: table =>
  87. {
  88. table.PrimaryKey("PK_Qualifications", x => x.Id);
  89. });
  90. migrationBuilder.CreateTable(
  91. name: "Universities",
  92. columns: table => new
  93. {
  94. Id = table.Column<long>(type: "bigint", nullable: false)
  95. .Annotation("SqlServer:Identity", "1, 1"),
  96. NameAr = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
  97. NameEn = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false)
  98. },
  99. constraints: table =>
  100. {
  101. table.PrimaryKey("PK_Universities", x => x.Id);
  102. });
  103. migrationBuilder.UpdateData(
  104. table: "AspNetUsers",
  105. keyColumn: "Id",
  106. keyValue: "ADMB3B92-2311-48F8-9DEC-F9FAEF1F21UA",
  107. columns: new[] { "CountryId", "IndustryId", "JobTitleId", "UniversityId" },
  108. values: new object[] { null, null, null, null });
  109. migrationBuilder.UpdateData(
  110. table: "AspNetUsers",
  111. keyColumn: "Id",
  112. keyValue: "AL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB",
  113. columns: new[] { "CountryId", "IndustryId", "JobTitleId", "UniversityId" },
  114. values: new object[] { null, null, null, null });
  115. }
  116. /// <inheritdoc />
  117. protected override void Down(MigrationBuilder migrationBuilder)
  118. {
  119. migrationBuilder.DropTable(
  120. name: "CountryLookups");
  121. migrationBuilder.DropTable(
  122. name: "Industries");
  123. migrationBuilder.DropTable(
  124. name: "JobTitles");
  125. migrationBuilder.DropTable(
  126. name: "Qualifications");
  127. migrationBuilder.DropTable(
  128. name: "Universities");
  129. migrationBuilder.DropColumn(
  130. name: "CountryId",
  131. table: "AspNetUsers");
  132. migrationBuilder.DropColumn(
  133. name: "IndustryId",
  134. table: "AspNetUsers");
  135. migrationBuilder.DropColumn(
  136. name: "JobTitleId",
  137. table: "AspNetUsers");
  138. migrationBuilder.DropColumn(
  139. name: "UniversityId",
  140. table: "AspNetUsers");
  141. migrationBuilder.AddColumn<string>(
  142. name: "JobTitle",
  143. table: "AspNetUsers",
  144. type: "nvarchar(max)",
  145. nullable: true);
  146. migrationBuilder.AddColumn<string>(
  147. name: "University",
  148. table: "AspNetUsers",
  149. type: "nvarchar(max)",
  150. nullable: true);
  151. migrationBuilder.UpdateData(
  152. table: "AspNetUsers",
  153. keyColumn: "Id",
  154. keyValue: "ADMB3B92-2311-48F8-9DEC-F9FAEF1F21UA",
  155. columns: new[] { "JobTitle", "University" },
  156. values: new object[] { null, null });
  157. migrationBuilder.UpdateData(
  158. table: "AspNetUsers",
  159. keyColumn: "Id",
  160. keyValue: "AL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB",
  161. columns: new[] { "JobTitle", "University" },
  162. values: new object[] { null, null });
  163. }
  164. }
  165. }