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 { /// public partial class UpdateDB : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "Data", table: "Sections"); migrationBuilder.AddColumn>( name: "BadLevel", table: "Sections", type: "jsonb", nullable: true); migrationBuilder.AddColumn( name: "CenterLatitude", table: "Sections", type: "text", nullable: true); migrationBuilder.AddColumn( name: "CenterLongitude", table: "Sections", type: "text", nullable: true); migrationBuilder.AddColumn( name: "City", table: "Sections", type: "text", nullable: true); migrationBuilder.AddColumn( name: "Cols", table: "Sections", type: "integer", nullable: true); migrationBuilder.AddColumn( name: "ContentId", table: "Sections", type: "text", nullable: true); migrationBuilder.AddColumn( name: "ContentId1", table: "Sections", type: "integer", nullable: true); migrationBuilder.AddColumn( name: "Discriminator", table: "Sections", type: "character varying(8)", maxLength: 8, nullable: false, defaultValue: ""); migrationBuilder.AddColumn>( name: "GoodLevel", table: "Sections", type: "jsonb", nullable: true); migrationBuilder.AddColumn>( name: "GreatLevel", table: "Sections", type: "jsonb", nullable: true); migrationBuilder.AddColumn( name: "MapProvider", table: "Sections", type: "integer", nullable: true); migrationBuilder.AddColumn( name: "MapType", table: "Sections", type: "integer", nullable: true); migrationBuilder.AddColumn( name: "MapTypeMapbox", table: "Sections", type: "integer", nullable: true); migrationBuilder.AddColumn>( name: "MediumLevel", table: "Sections", type: "jsonb", nullable: true); migrationBuilder.AddColumn>( name: "MessageDebut", table: "Sections", type: "jsonb", nullable: true); migrationBuilder.AddColumn>( name: "MessageFin", table: "Sections", type: "jsonb", nullable: true); migrationBuilder.AddColumn( name: "ResourceId", table: "Sections", type: "text", nullable: true); migrationBuilder.AddColumn( name: "Result", table: "Sections", type: "text", nullable: true); migrationBuilder.AddColumn( name: "Rows", table: "Sections", type: "integer", nullable: true); migrationBuilder.AddColumn( name: "SectionMenuId", table: "Sections", type: "text", nullable: true); migrationBuilder.AddColumn( name: "SectionWeb_Source", table: "Sections", type: "text", nullable: true); migrationBuilder.AddColumn( name: "Source", table: "Sections", type: "text", nullable: true); migrationBuilder.AddColumn( name: "UpdatedDate", table: "Sections", type: "timestamp with time zone", nullable: true); migrationBuilder.AddColumn( name: "Zoom", table: "Sections", type: "integer", nullable: true); migrationBuilder.AddColumn>( name: "audioIds", table: "Sections", type: "jsonb", nullable: true); migrationBuilder.AddColumn>( name: "content", table: "Sections", type: "jsonb", nullable: true); migrationBuilder.AddColumn( name: "isContentTop", table: "Sections", type: "boolean", nullable: true); migrationBuilder.AddColumn( name: "isReadAudioAuto", table: "Sections", type: "boolean", nullable: true); migrationBuilder.AddColumn( name: "mapProvider", table: "Sections", type: "integer", nullable: true); migrationBuilder.AddColumn>( name: "resourceIds", table: "Sections", type: "jsonb", nullable: true); migrationBuilder.CreateTable( name: "Categorie", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Label = table.Column>(type: "jsonb", nullable: false), Icon = table.Column(type: "text", nullable: true), ResourceId = table.Column(type: "text", nullable: true), Order = table.Column(type: "integer", nullable: true), SectionMapId = table.Column(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(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Title = table.Column>(type: "jsonb", nullable: false), Description = table.Column>(type: "jsonb", nullable: false), ResourceId = table.Column(type: "text", nullable: true), Order = table.Column(type: "integer", nullable: false), SectionArticleId = table.Column(type: "text", nullable: true), SectionSliderId = table.Column(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(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Title = table.Column>(type: "jsonb", nullable: false), Description = table.Column>(type: "jsonb", nullable: false), Contents = table.Column>(type: "jsonb", nullable: false), CategorieId = table.Column(type: "integer", nullable: true), Latitude = table.Column(type: "text", nullable: true), Longitude = table.Column(type: "text", nullable: true), ImageResourceId = table.Column(type: "text", nullable: true), ImageUrl = table.Column(type: "text", nullable: true), Schedules = table.Column>(type: "jsonb", nullable: false), Prices = table.Column>(type: "jsonb", nullable: false), Phone = table.Column>(type: "jsonb", nullable: false), Email = table.Column>(type: "jsonb", nullable: false), Site = table.Column>(type: "jsonb", nullable: false), SectionMapId = table.Column(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(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), TranslationAndResources = table.Column>(type: "jsonb", nullable: false), Order = table.Column(type: "integer", nullable: false), SectionPdfId = table.Column(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(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Label = table.Column>(type: "jsonb", nullable: false), ResourceId = table.Column(type: "text", nullable: true), Order = table.Column(type: "integer", nullable: false), Responses = table.Column>(type: "jsonb", nullable: false), SectionQuizId = table.Column(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"); } /// 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( name: "Data", table: "Sections", type: "text", nullable: false, defaultValue: ""); } } }