using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CvSearch.Models.Migrations
{
///
public partial class AddJobSearchTables : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.EnsureSchema(
name: "cvSearch");
migrationBuilder.CreateTable(
name: "JobSearchResults",
schema: "cvSearch",
columns: table => new
{
Id = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false),
SessionId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false),
ProviderName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false),
JobUrl = table.Column(type: "nvarchar(2048)", maxLength: 2048, nullable: false),
JobTitle = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: false),
JobText = table.Column(type: "nvarchar(max)", nullable: false),
Score = table.Column(type: "int", nullable: false),
ResultJson = table.Column(type: "nvarchar(max)", nullable: false),
CreatedAt = table.Column(type: "datetime2", nullable: false, defaultValueSql: "SYSUTCDATETIME()")
},
constraints: table =>
{
table.PrimaryKey("PK_JobSearchResults", x => x.Id);
});
migrationBuilder.CreateTable(
name: "JobSearchSessions",
schema: "cvSearch",
columns: table => new
{
Id = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false),
TokenId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false),
CvDocumentId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false),
Email = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false),
Status = table.Column(type: "nvarchar(32)", maxLength: 32, nullable: false),
Keywords = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
ProviderConfigJson = table.Column(type: "nvarchar(max)", nullable: true),
CreatedAt = table.Column(type: "datetime2", nullable: false, defaultValueSql: "SYSUTCDATETIME()")
},
constraints: table =>
{
table.PrimaryKey("PK_JobSearchSessions", x => x.Id);
});
migrationBuilder.CreateTable(
name: "JobSearchTokens",
schema: "cvSearch",
columns: table => new
{
Id = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false),
CvDocumentId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false),
Email = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false),
ExpiresAt = table.Column(type: "datetime2", nullable: false),
Used = table.Column(type: "bit", nullable: false, defaultValue: false),
CreatedAt = table.Column(type: "datetime2", nullable: false, defaultValueSql: "SYSUTCDATETIME()")
},
constraints: table =>
{
table.PrimaryKey("PK_JobSearchTokens", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_JobSearchResults_SessionId",
schema: "cvSearch",
table: "JobSearchResults",
column: "SessionId");
migrationBuilder.CreateIndex(
name: "IX_JobSearchSessions_Status",
schema: "cvSearch",
table: "JobSearchSessions",
column: "Status");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "JobSearchResults",
schema: "cvSearch");
migrationBuilder.DropTable(
name: "JobSearchSessions",
schema: "cvSearch");
migrationBuilder.DropTable(
name: "JobSearchTokens",
schema: "cvSearch");
}
}
}