using System.Collections.Generic;
using ManagerService.Data.SubSection;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace ManagerService.Migrations
{
///
public partial class UpdateMix3 : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_GeoPoint_Sections_SectionMapId",
table: "GeoPoint");
migrationBuilder.DropForeignKey(
name: "FK_Resources_GeoPoint_GeoPointId",
table: "Resources");
migrationBuilder.DropTable(
name: "Content");
migrationBuilder.DropIndex(
name: "IX_Resources_GeoPointId",
table: "Resources");
migrationBuilder.DropPrimaryKey(
name: "PK_GeoPoint",
table: "GeoPoint");
migrationBuilder.DropColumn(
name: "GeoPointId",
table: "Resources");
migrationBuilder.RenameTable(
name: "GeoPoint",
newName: "GeoPoints");
migrationBuilder.RenameIndex(
name: "IX_GeoPoint_SectionMapId",
table: "GeoPoints",
newName: "IX_GeoPoints_SectionMapId");
migrationBuilder.AddColumn>(
name: "ArticleContents",
table: "Sections",
type: "jsonb",
nullable: true);
migrationBuilder.AddColumn>(
name: "SliderContents",
table: "Sections",
type: "jsonb",
nullable: true);
migrationBuilder.AddColumn>(
name: "Contents",
table: "GeoPoints",
type: "jsonb",
nullable: false);
migrationBuilder.AddPrimaryKey(
name: "PK_GeoPoints",
table: "GeoPoints",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_GeoPoints_Sections_SectionMapId",
table: "GeoPoints",
column: "SectionMapId",
principalTable: "Sections",
principalColumn: "Id");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_GeoPoints_Sections_SectionMapId",
table: "GeoPoints");
migrationBuilder.DropPrimaryKey(
name: "PK_GeoPoints",
table: "GeoPoints");
migrationBuilder.DropColumn(
name: "ArticleContents",
table: "Sections");
migrationBuilder.DropColumn(
name: "SliderContents",
table: "Sections");
migrationBuilder.DropColumn(
name: "Contents",
table: "GeoPoints");
migrationBuilder.RenameTable(
name: "GeoPoints",
newName: "GeoPoint");
migrationBuilder.RenameIndex(
name: "IX_GeoPoints_SectionMapId",
table: "GeoPoint",
newName: "IX_GeoPoint_SectionMapId");
migrationBuilder.AddColumn(
name: "GeoPointId",
table: "Resources",
type: "integer",
nullable: true);
migrationBuilder.AddPrimaryKey(
name: "PK_GeoPoint",
table: "GeoPoint",
column: "Id");
migrationBuilder.CreateTable(
name: "Content",
columns: table => new
{
Id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ResourceId = table.Column(type: "text", nullable: true),
Description = table.Column>(type: "jsonb", nullable: false),
Order = table.Column(type: "integer", nullable: false),
SectionArticleId = table.Column(type: "text", nullable: true),
SectionSliderId = table.Column(type: "text", nullable: true),
Title = table.Column>(type: "jsonb", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Content", x => x.Id);
table.ForeignKey(
name: "FK_Content_Resources_ResourceId",
column: x => x.ResourceId,
principalTable: "Resources",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Content_Sections_SectionArticleId",
column: x => x.SectionArticleId,
principalTable: "Sections",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Content_Sections_SectionSliderId",
column: x => x.SectionSliderId,
principalTable: "Sections",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_Resources_GeoPointId",
table: "Resources",
column: "GeoPointId");
migrationBuilder.CreateIndex(
name: "IX_Content_ResourceId",
table: "Content",
column: "ResourceId");
migrationBuilder.CreateIndex(
name: "IX_Content_SectionArticleId",
table: "Content",
column: "SectionArticleId");
migrationBuilder.CreateIndex(
name: "IX_Content_SectionSliderId",
table: "Content",
column: "SectionSliderId");
migrationBuilder.AddForeignKey(
name: "FK_GeoPoint_Sections_SectionMapId",
table: "GeoPoint",
column: "SectionMapId",
principalTable: "Sections",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Resources_GeoPoint_GeoPointId",
table: "Resources",
column: "GeoPointId",
principalTable: "GeoPoint",
principalColumn: "Id");
}
}
}