manager-service/ManagerService/Migrations/20250324151019_UpdateMix5.cs

60 lines
2.3 KiB
C#

using System.Collections.Generic;
using ManagerService.Data.SubSection;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace ManagerService.Migrations
{
/// <inheritdoc />
public partial class UpdateMix5 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "OrderedTranslationAndResource");
migrationBuilder.AddColumn<List<OrderedTranslationAndResource>>(
name: "PDFOrderedTranslationAndResources",
table: "Sections",
type: "jsonb",
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "PDFOrderedTranslationAndResources",
table: "Sections");
migrationBuilder.CreateTable(
name: "OrderedTranslationAndResource",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Order = table.Column<int>(type: "integer", nullable: false),
SectionPdfId = table.Column<string>(type: "text", nullable: true),
TranslationAndResources = table.Column<List<TranslationAndResource>>(type: "jsonb", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_OrderedTranslationAndResource", x => x.Id);
table.ForeignKey(
name: "FK_OrderedTranslationAndResource_Sections_SectionPdfId",
column: x => x.SectionPdfId,
principalTable: "Sections",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_OrderedTranslationAndResource_SectionPdfId",
table: "OrderedTranslationAndResource",
column: "SectionPdfId");
}
}
}