597 lines
22 KiB
C#
597 lines
22 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Manager.DTOs;
|
|
using ManagerService.DTOs;
|
|
using ManagerService.Data;
|
|
using ManagerService.Data.SubSection;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
|
|
#nullable disable
|
|
|
|
namespace ManagerService.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class UpdateDB : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropColumn(
|
|
name: "Data",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.AddColumn<List<TranslationAndResource>>(
|
|
name: "BadLevel",
|
|
table: "Sections",
|
|
type: "jsonb",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "CenterLatitude",
|
|
table: "Sections",
|
|
type: "text",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "CenterLongitude",
|
|
table: "Sections",
|
|
type: "text",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "City",
|
|
table: "Sections",
|
|
type: "text",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "Cols",
|
|
table: "Sections",
|
|
type: "integer",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "ContentId",
|
|
table: "Sections",
|
|
type: "text",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "ContentId1",
|
|
table: "Sections",
|
|
type: "integer",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "Discriminator",
|
|
table: "Sections",
|
|
type: "character varying(8)",
|
|
maxLength: 8,
|
|
nullable: false,
|
|
defaultValue: "");
|
|
|
|
migrationBuilder.AddColumn<List<TranslationAndResource>>(
|
|
name: "GoodLevel",
|
|
table: "Sections",
|
|
type: "jsonb",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<List<TranslationAndResource>>(
|
|
name: "GreatLevel",
|
|
table: "Sections",
|
|
type: "jsonb",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "MapProvider",
|
|
table: "Sections",
|
|
type: "integer",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "MapType",
|
|
table: "Sections",
|
|
type: "integer",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "MapTypeMapbox",
|
|
table: "Sections",
|
|
type: "integer",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<List<TranslationAndResource>>(
|
|
name: "MediumLevel",
|
|
table: "Sections",
|
|
type: "jsonb",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<List<TranslationAndResource>>(
|
|
name: "MessageDebut",
|
|
table: "Sections",
|
|
type: "jsonb",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<List<TranslationAndResource>>(
|
|
name: "MessageFin",
|
|
table: "Sections",
|
|
type: "jsonb",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "ResourceId",
|
|
table: "Sections",
|
|
type: "text",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "Result",
|
|
table: "Sections",
|
|
type: "text",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "Rows",
|
|
table: "Sections",
|
|
type: "integer",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "SectionMenuId",
|
|
table: "Sections",
|
|
type: "text",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "SectionWeb_Source",
|
|
table: "Sections",
|
|
type: "text",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "Source",
|
|
table: "Sections",
|
|
type: "text",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<DateTimeOffset>(
|
|
name: "UpdatedDate",
|
|
table: "Sections",
|
|
type: "timestamp with time zone",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "Zoom",
|
|
table: "Sections",
|
|
type: "integer",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<List<Translation>>(
|
|
name: "audioIds",
|
|
table: "Sections",
|
|
type: "jsonb",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<List<Translation>>(
|
|
name: "content",
|
|
table: "Sections",
|
|
type: "jsonb",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "isContentTop",
|
|
table: "Sections",
|
|
type: "boolean",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "isReadAudioAuto",
|
|
table: "Sections",
|
|
type: "boolean",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "mapProvider",
|
|
table: "Sections",
|
|
type: "integer",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<List<Translation>>(
|
|
name: "resourceIds",
|
|
table: "Sections",
|
|
type: "jsonb",
|
|
nullable: true);
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Categorie",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
Label = table.Column<List<Translation>>(type: "jsonb", nullable: false),
|
|
Icon = table.Column<string>(type: "text", nullable: true),
|
|
ResourceId = table.Column<string>(type: "text", nullable: true),
|
|
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.CreateTable(
|
|
name: "Content",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
Title = table.Column<List<Translation>>(type: "jsonb", nullable: false),
|
|
Description = table.Column<List<Translation>>(type: "jsonb", nullable: false),
|
|
ResourceId = table.Column<string>(type: "text", nullable: true),
|
|
Order = table.Column<int>(type: "integer", nullable: false),
|
|
SectionArticleId = table.Column<string>(type: "text", nullable: true),
|
|
SectionSliderId = table.Column<string>(type: "text", nullable: true)
|
|
},
|
|
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.CreateTable(
|
|
name: "GeoPoint",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
Title = table.Column<List<Translation>>(type: "jsonb", nullable: false),
|
|
Description = table.Column<List<Translation>>(type: "jsonb", nullable: false),
|
|
Contents = table.Column<List<Resource>>(type: "jsonb", nullable: false),
|
|
CategorieId = table.Column<int>(type: "integer", nullable: true),
|
|
Latitude = table.Column<string>(type: "text", nullable: true),
|
|
Longitude = table.Column<string>(type: "text", nullable: true),
|
|
ImageResourceId = table.Column<string>(type: "text", nullable: true),
|
|
ImageUrl = table.Column<string>(type: "text", nullable: true),
|
|
Schedules = table.Column<List<TranslationDTO>>(type: "jsonb", nullable: false),
|
|
Prices = table.Column<List<TranslationDTO>>(type: "jsonb", nullable: false),
|
|
Phone = table.Column<List<TranslationDTO>>(type: "jsonb", nullable: false),
|
|
Email = table.Column<List<TranslationDTO>>(type: "jsonb", nullable: false),
|
|
Site = table.Column<List<TranslationDTO>>(type: "jsonb", nullable: false),
|
|
SectionMapId = table.Column<string>(type: "text", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_GeoPoint", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_GeoPoint_Sections_SectionMapId",
|
|
column: x => x.SectionMapId,
|
|
principalTable: "Sections",
|
|
principalColumn: "Id");
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "OrderedTranslationAndResource",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
TranslationAndResources = table.Column<List<TranslationAndResource>>(type: "jsonb", nullable: false),
|
|
Order = table.Column<int>(type: "integer", nullable: false),
|
|
SectionPdfId = table.Column<string>(type: "text", nullable: true)
|
|
},
|
|
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.CreateTable(
|
|
name: "QuizQuestion",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
Label = table.Column<List<TranslationAndResourceDTO>>(type: "jsonb", nullable: false),
|
|
ResourceId = table.Column<string>(type: "text", nullable: true),
|
|
Order = table.Column<int>(type: "integer", nullable: false),
|
|
Responses = table.Column<List<ResponseDTO>>(type: "jsonb", nullable: false),
|
|
SectionQuizId = table.Column<string>(type: "text", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_QuizQuestion", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_QuizQuestion_Resources_ResourceId",
|
|
column: x => x.ResourceId,
|
|
principalTable: "Resources",
|
|
principalColumn: "Id");
|
|
table.ForeignKey(
|
|
name: "FK_QuizQuestion_Sections_SectionQuizId",
|
|
column: x => x.SectionQuizId,
|
|
principalTable: "Sections",
|
|
principalColumn: "Id");
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Sections_ContentId1",
|
|
table: "Sections",
|
|
column: "ContentId1");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Sections_ResourceId",
|
|
table: "Sections",
|
|
column: "ResourceId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Sections_SectionMenuId",
|
|
table: "Sections",
|
|
column: "SectionMenuId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Categorie_ResourceId",
|
|
table: "Categorie",
|
|
column: "ResourceId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Categorie_SectionMapId",
|
|
table: "Categorie",
|
|
column: "SectionMapId");
|
|
|
|
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.CreateIndex(
|
|
name: "IX_GeoPoint_SectionMapId",
|
|
table: "GeoPoint",
|
|
column: "SectionMapId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_OrderedTranslationAndResource_SectionPdfId",
|
|
table: "OrderedTranslationAndResource",
|
|
column: "SectionPdfId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_QuizQuestion_ResourceId",
|
|
table: "QuizQuestion",
|
|
column: "ResourceId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_QuizQuestion_SectionQuizId",
|
|
table: "QuizQuestion",
|
|
column: "SectionQuizId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Sections_Content_ContentId1",
|
|
table: "Sections",
|
|
column: "ContentId1",
|
|
principalTable: "Content",
|
|
principalColumn: "Id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Sections_Resources_ResourceId",
|
|
table: "Sections",
|
|
column: "ResourceId",
|
|
principalTable: "Resources",
|
|
principalColumn: "Id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Sections_Sections_SectionMenuId",
|
|
table: "Sections",
|
|
column: "SectionMenuId",
|
|
principalTable: "Sections",
|
|
principalColumn: "Id");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Sections_Content_ContentId1",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Sections_Resources_ResourceId",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Sections_Sections_SectionMenuId",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Categorie");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Content");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "GeoPoint");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "OrderedTranslationAndResource");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "QuizQuestion");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Sections_ContentId1",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Sections_ResourceId",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Sections_SectionMenuId",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "BadLevel",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "CenterLatitude",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "CenterLongitude",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "City",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "Cols",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "ContentId",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "ContentId1",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "Discriminator",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "GoodLevel",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "GreatLevel",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "MapProvider",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "MapType",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "MapTypeMapbox",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "MediumLevel",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "MessageDebut",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "MessageFin",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "ResourceId",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "Result",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "Rows",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "SectionMenuId",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "SectionWeb_Source",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "Source",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "UpdatedDate",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "Zoom",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "audioIds",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "content",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "isContentTop",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "isReadAudioAuto",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "mapProvider",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "resourceIds",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "Data",
|
|
table: "Sections",
|
|
type: "text",
|
|
nullable: false,
|
|
defaultValue: "");
|
|
}
|
|
}
|
|
}
|