Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

20221116135205_addedSelectionLevesAndProcesses.cs 4.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace Diligent.WebAPI.Data.Migrations
  5. {
  6. public partial class addedSelectionLevesAndProcesses : Migration
  7. {
  8. protected override void Up(MigrationBuilder migrationBuilder)
  9. {
  10. migrationBuilder.CreateTable(
  11. name: "SelectionLevels",
  12. columns: table => new
  13. {
  14. Id = table.Column<int>(type: "int", nullable: false)
  15. .Annotation("SqlServer:Identity", "1, 1"),
  16. Name = table.Column<string>(type: "nvarchar(max)", nullable: false)
  17. },
  18. constraints: table =>
  19. {
  20. table.PrimaryKey("PK_SelectionLevels", x => x.Id);
  21. });
  22. migrationBuilder.CreateTable(
  23. name: "SelectionProcesses",
  24. columns: table => new
  25. {
  26. Id = table.Column<int>(type: "int", nullable: false)
  27. .Annotation("SqlServer:Identity", "1, 1"),
  28. Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
  29. Status = table.Column<string>(type: "nvarchar(max)", nullable: false),
  30. Date = table.Column<DateTime>(type: "datetime2", nullable: true),
  31. Link = table.Column<string>(type: "nvarchar(max)", nullable: true),
  32. SchedulerId = table.Column<int>(type: "int", nullable: true),
  33. SelectionLevelId = table.Column<int>(type: "int", nullable: false),
  34. ApplicantId = table.Column<int>(type: "int", nullable: false)
  35. },
  36. constraints: table =>
  37. {
  38. table.PrimaryKey("PK_SelectionProcesses", x => x.Id);
  39. table.ForeignKey(
  40. name: "FK_SelectionProcesses_Applicants_ApplicantId",
  41. column: x => x.ApplicantId,
  42. principalTable: "Applicants",
  43. principalColumn: "ApplicantId",
  44. onDelete: ReferentialAction.Cascade);
  45. table.ForeignKey(
  46. name: "FK_SelectionProcesses_AspNetUsers_SchedulerId",
  47. column: x => x.SchedulerId,
  48. principalTable: "AspNetUsers",
  49. principalColumn: "Id");
  50. table.ForeignKey(
  51. name: "FK_SelectionProcesses_SelectionLevels_SelectionLevelId",
  52. column: x => x.SelectionLevelId,
  53. principalTable: "SelectionLevels",
  54. principalColumn: "Id",
  55. onDelete: ReferentialAction.Cascade);
  56. });
  57. migrationBuilder.InsertData(
  58. table: "SelectionLevels",
  59. columns: new[] { "Id", "Name" },
  60. values: new object[,]
  61. {
  62. { 1, "HR intervju" },
  63. { 2, "Screening test" },
  64. { 3, "Tehnicki intervju" },
  65. { 4, "Konacna odluka" }
  66. });
  67. migrationBuilder.CreateIndex(
  68. name: "IX_SelectionProcesses_ApplicantId",
  69. table: "SelectionProcesses",
  70. column: "ApplicantId");
  71. migrationBuilder.CreateIndex(
  72. name: "IX_SelectionProcesses_SchedulerId",
  73. table: "SelectionProcesses",
  74. column: "SchedulerId");
  75. migrationBuilder.CreateIndex(
  76. name: "IX_SelectionProcesses_SelectionLevelId",
  77. table: "SelectionProcesses",
  78. column: "SelectionLevelId");
  79. }
  80. protected override void Down(MigrationBuilder migrationBuilder)
  81. {
  82. migrationBuilder.DropTable(
  83. name: "SelectionProcesses");
  84. migrationBuilder.DropTable(
  85. name: "SelectionLevels");
  86. }
  87. }
  88. }