manager-service/ManagerService/Migrations/20250324150634_UpdateMix4.cs

72 lines
2.7 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 UpdateMix4 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Categorie");
migrationBuilder.AddColumn<List<Categorie>>(
name: "MapCategories",
table: "Sections",
type: "jsonb",
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "MapCategories",
table: "Sections");
migrationBuilder.CreateTable(
name: "Categorie",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ResourceId = table.Column<string>(type: "text", nullable: true),
Icon = table.Column<string>(type: "text", nullable: true),
Label = table.Column<List<Translation>>(type: "jsonb", nullable: false),
Order = table.Column<int>(type: "integer", nullable: true),
SectionMapId = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Categorie", x => x.Id);
table.ForeignKey(
name: "FK_Categorie_Resources_ResourceId",
column: x => x.ResourceId,
principalTable: "Resources",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Categorie_Sections_SectionMapId",
column: x => x.SectionMapId,
principalTable: "Sections",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_Categorie_ResourceId",
table: "Categorie",
column: "ResourceId");
migrationBuilder.CreateIndex(
name: "IX_Categorie_SectionMapId",
table: "Categorie",
column: "SectionMapId");
}
}
}