using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace JobTrackerApi.Migrations
{
///
public partial class AddCvVariants : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "CvVariants",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
OwnerUserId = table.Column(type: "TEXT", nullable: false),
PublicSlug = table.Column(type: "TEXT", nullable: false),
Name = table.Column(type: "TEXT", nullable: false),
JobApplicationId = table.Column(type: "INTEGER", nullable: true),
SettingsJson = table.Column(type: "TEXT", nullable: false),
IsPublic = table.Column(type: "INTEGER", nullable: false),
Version = table.Column(type: "INTEGER", nullable: false),
CreatedAtUtc = table.Column(type: "TEXT", nullable: false),
UpdatedAtUtc = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CvVariants", x => x.Id);
table.ForeignKey(
name: "FK_CvVariants_JobApplications_JobApplicationId",
column: x => x.JobApplicationId,
principalTable: "JobApplications",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable(
name: "CvVariantVersions",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
OwnerUserId = table.Column(type: "TEXT", nullable: false),
CvVariantId = table.Column(type: "INTEGER", nullable: false),
Version = table.Column(type: "INTEGER", nullable: false),
SettingsJson = table.Column(type: "TEXT", nullable: false),
Source = table.Column(type: "TEXT", nullable: false),
CreatedAtUtc = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CvVariantVersions", x => x.Id);
table.ForeignKey(
name: "FK_CvVariantVersions_CvVariants_CvVariantId",
column: x => x.CvVariantId,
principalTable: "CvVariants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_CvVariants_JobApplicationId",
table: "CvVariants",
column: "JobApplicationId");
migrationBuilder.CreateIndex(
name: "IX_CvVariants_OwnerUserId_UpdatedAtUtc",
table: "CvVariants",
columns: new[] { "OwnerUserId", "UpdatedAtUtc" });
migrationBuilder.CreateIndex(
name: "IX_CvVariants_PublicSlug",
table: "CvVariants",
column: "PublicSlug",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_CvVariantVersions_CvVariantId_Version",
table: "CvVariantVersions",
columns: new[] { "CvVariantId", "Version" });
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CvVariantVersions");
migrationBuilder.DropTable(
name: "CvVariants");
}
}
}