using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Diligent.WebAPI.Data.Migrations { public partial class addedSelectionLevesAndProcesses : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "SelectionLevels", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Name = table.Column(type: "nvarchar(max)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_SelectionLevels", x => x.Id); }); migrationBuilder.CreateTable( name: "SelectionProcesses", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Name = table.Column(type: "nvarchar(max)", nullable: false), Status = table.Column(type: "nvarchar(max)", nullable: false), Date = table.Column(type: "datetime2", nullable: true), Link = table.Column(type: "nvarchar(max)", nullable: true), SchedulerId = table.Column(type: "int", nullable: true), SelectionLevelId = table.Column(type: "int", nullable: false), ApplicantId = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_SelectionProcesses", x => x.Id); table.ForeignKey( name: "FK_SelectionProcesses_Applicants_ApplicantId", column: x => x.ApplicantId, principalTable: "Applicants", principalColumn: "ApplicantId", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_SelectionProcesses_AspNetUsers_SchedulerId", column: x => x.SchedulerId, principalTable: "AspNetUsers", principalColumn: "Id"); table.ForeignKey( name: "FK_SelectionProcesses_SelectionLevels_SelectionLevelId", column: x => x.SelectionLevelId, principalTable: "SelectionLevels", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.InsertData( table: "SelectionLevels", columns: new[] { "Id", "Name" }, values: new object[,] { { 1, "HR intervju" }, { 2, "Screening test" }, { 3, "Tehnicki intervju" }, { 4, "Konacna odluka" } }); migrationBuilder.CreateIndex( name: "IX_SelectionProcesses_ApplicantId", table: "SelectionProcesses", column: "ApplicantId"); migrationBuilder.CreateIndex( name: "IX_SelectionProcesses_SchedulerId", table: "SelectionProcesses", column: "SchedulerId"); migrationBuilder.CreateIndex( name: "IX_SelectionProcesses_SelectionLevelId", table: "SelectionProcesses", column: "SelectionLevelId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "SelectionProcesses"); migrationBuilder.DropTable( name: "SelectionLevels"); } } }