using System.Collections.Generic; using Microsoft.EntityFrameworkCore.Migrations; using NetTopologySuite.Geometries; #nullable disable namespace ManagerService.Migrations { /// public partial class UpdateCoordinatesToGeom : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_EventAgenda_Resources_ResourceId", table: "EventAgenda"); migrationBuilder.DropForeignKey( name: "FK_EventAgenda_Sections_SectionAgendaId", table: "EventAgenda"); migrationBuilder.DropForeignKey( name: "FK_EventAgenda_Sections_SectionEventId", table: "EventAgenda"); migrationBuilder.DropForeignKey( name: "FK_MapAnnotation_ProgrammeBlock_ProgrammeBlockId", table: "MapAnnotation"); migrationBuilder.DropForeignKey( name: "FK_ProgrammeBlock_Sections_SectionEventId", table: "ProgrammeBlock"); migrationBuilder.DropPrimaryKey( name: "PK_ProgrammeBlock", table: "ProgrammeBlock"); migrationBuilder.DropPrimaryKey( name: "PK_EventAgenda", table: "EventAgenda"); migrationBuilder.DropColumn( name: "Coordinates", table: "MapAnnotation"); migrationBuilder.DropColumn( name: "Coordinates", table: "GuidedSteps"); migrationBuilder.DropColumn( name: "GeometryType", table: "GuidedSteps"); migrationBuilder.DropColumn( name: "Coordinates", table: "GeoPoints"); migrationBuilder.DropColumn( name: "GeometryType", table: "GeoPoints"); migrationBuilder.RenameTable( name: "ProgrammeBlock", newName: "ProgrammeBlocks"); migrationBuilder.RenameTable( name: "EventAgenda", newName: "EventAgendas"); migrationBuilder.RenameIndex( name: "IX_ProgrammeBlock_SectionEventId", table: "ProgrammeBlocks", newName: "IX_ProgrammeBlocks_SectionEventId"); migrationBuilder.RenameIndex( name: "IX_EventAgenda_SectionEventId", table: "EventAgendas", newName: "IX_EventAgendas_SectionEventId"); migrationBuilder.RenameIndex( name: "IX_EventAgenda_SectionAgendaId", table: "EventAgendas", newName: "IX_EventAgendas_SectionAgendaId"); migrationBuilder.RenameIndex( name: "IX_EventAgenda_ResourceId", table: "EventAgendas", newName: "IX_EventAgendas_ResourceId"); migrationBuilder.AlterDatabase() .Annotation("Npgsql:PostgresExtension:postgis", ",,"); migrationBuilder.AddColumn( name: "Geometry", table: "MapAnnotation", type: "geometry", nullable: true); migrationBuilder.AddColumn( name: "PolyColor", table: "MapAnnotation", type: "text", nullable: true); migrationBuilder.AddColumn( name: "Geometry", table: "GuidedSteps", type: "geometry", nullable: true); migrationBuilder.AddColumn( name: "Geometry", table: "GeoPoints", type: "geometry", nullable: true); migrationBuilder.AddPrimaryKey( name: "PK_ProgrammeBlocks", table: "ProgrammeBlocks", column: "Id"); migrationBuilder.AddPrimaryKey( name: "PK_EventAgendas", table: "EventAgendas", column: "Id"); migrationBuilder.CreateTable( name: "ApplicationInstances", columns: table => new { Id = table.Column(type: "text", nullable: false), InstanceId = table.Column(type: "text", nullable: false), AppType = table.Column(type: "integer", nullable: false), MainImageId = table.Column(type: "text", nullable: true), MainImageUrl = table.Column(type: "text", nullable: true), LoaderImageId = table.Column(type: "text", nullable: true), LoaderImageUrl = table.Column(type: "text", nullable: true), IsDate = table.Column(type: "boolean", nullable: false), IsHour = table.Column(type: "boolean", nullable: false), PrimaryColor = table.Column(type: "text", nullable: true), SecondaryColor = table.Column(type: "text", nullable: true), RoundedValue = table.Column(type: "integer", nullable: true), ScreenPercentageSectionsMainPage = table.Column(type: "integer", nullable: true), IsSectionImageBackground = table.Column(type: "boolean", nullable: false), LayoutMainPage = table.Column(type: "integer", nullable: false), Languages = table.Column>(type: "text[]", nullable: true), SectionEventId = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_ApplicationInstances", x => x.Id); table.ForeignKey( name: "FK_ApplicationInstances_Sections_SectionEventId", column: x => x.SectionEventId, principalTable: "Sections", principalColumn: "Id"); }); migrationBuilder.CreateTable( name: "AppConfigurationLinks", columns: table => new { Id = table.Column(type: "text", nullable: false), ConfigurationId = table.Column(type: "text", nullable: false), ApplicationInstanceId = table.Column(type: "text", nullable: false), Order = table.Column(type: "integer", nullable: true), IsActive = table.Column(type: "boolean", nullable: false), WeightMasonryGrid = table.Column(type: "integer", nullable: true) }, constraints: table => { table.PrimaryKey("PK_AppConfigurationLinks", x => x.Id); table.ForeignKey( name: "FK_AppConfigurationLinks_ApplicationInstances_ApplicationInsta~", column: x => x.ApplicationInstanceId, principalTable: "ApplicationInstances", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_AppConfigurationLinks_Configurations_ConfigurationId", column: x => x.ConfigurationId, principalTable: "Configurations", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_AppConfigurationLinks_ApplicationInstanceId", table: "AppConfigurationLinks", column: "ApplicationInstanceId"); migrationBuilder.CreateIndex( name: "IX_AppConfigurationLinks_ConfigurationId", table: "AppConfigurationLinks", column: "ConfigurationId"); migrationBuilder.CreateIndex( name: "IX_ApplicationInstances_SectionEventId", table: "ApplicationInstances", column: "SectionEventId"); migrationBuilder.AddForeignKey( name: "FK_EventAgendas_Resources_ResourceId", table: "EventAgendas", column: "ResourceId", principalTable: "Resources", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_EventAgendas_Sections_SectionAgendaId", table: "EventAgendas", column: "SectionAgendaId", principalTable: "Sections", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_EventAgendas_Sections_SectionEventId", table: "EventAgendas", column: "SectionEventId", principalTable: "Sections", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_MapAnnotation_ProgrammeBlocks_ProgrammeBlockId", table: "MapAnnotation", column: "ProgrammeBlockId", principalTable: "ProgrammeBlocks", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_ProgrammeBlocks_Sections_SectionEventId", table: "ProgrammeBlocks", column: "SectionEventId", principalTable: "Sections", principalColumn: "Id"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_EventAgendas_Resources_ResourceId", table: "EventAgendas"); migrationBuilder.DropForeignKey( name: "FK_EventAgendas_Sections_SectionAgendaId", table: "EventAgendas"); migrationBuilder.DropForeignKey( name: "FK_EventAgendas_Sections_SectionEventId", table: "EventAgendas"); migrationBuilder.DropForeignKey( name: "FK_MapAnnotation_ProgrammeBlocks_ProgrammeBlockId", table: "MapAnnotation"); migrationBuilder.DropForeignKey( name: "FK_ProgrammeBlocks_Sections_SectionEventId", table: "ProgrammeBlocks"); migrationBuilder.DropTable( name: "AppConfigurationLinks"); migrationBuilder.DropTable( name: "ApplicationInstances"); migrationBuilder.DropPrimaryKey( name: "PK_ProgrammeBlocks", table: "ProgrammeBlocks"); migrationBuilder.DropPrimaryKey( name: "PK_EventAgendas", table: "EventAgendas"); migrationBuilder.DropColumn( name: "Geometry", table: "MapAnnotation"); migrationBuilder.DropColumn( name: "PolyColor", table: "MapAnnotation"); migrationBuilder.DropColumn( name: "Geometry", table: "GuidedSteps"); migrationBuilder.DropColumn( name: "Geometry", table: "GeoPoints"); migrationBuilder.RenameTable( name: "ProgrammeBlocks", newName: "ProgrammeBlock"); migrationBuilder.RenameTable( name: "EventAgendas", newName: "EventAgenda"); migrationBuilder.RenameIndex( name: "IX_ProgrammeBlocks_SectionEventId", table: "ProgrammeBlock", newName: "IX_ProgrammeBlock_SectionEventId"); migrationBuilder.RenameIndex( name: "IX_EventAgendas_SectionEventId", table: "EventAgenda", newName: "IX_EventAgenda_SectionEventId"); migrationBuilder.RenameIndex( name: "IX_EventAgendas_SectionAgendaId", table: "EventAgenda", newName: "IX_EventAgenda_SectionAgendaId"); migrationBuilder.RenameIndex( name: "IX_EventAgendas_ResourceId", table: "EventAgenda", newName: "IX_EventAgenda_ResourceId"); migrationBuilder.AlterDatabase() .OldAnnotation("Npgsql:PostgresExtension:postgis", ",,"); migrationBuilder.AddColumn( name: "Coordinates", table: "MapAnnotation", type: "jsonb", nullable: true); migrationBuilder.AddColumn( name: "Coordinates", table: "GuidedSteps", type: "jsonb", nullable: true); migrationBuilder.AddColumn( name: "GeometryType", table: "GuidedSteps", type: "integer", nullable: false, defaultValue: 0); migrationBuilder.AddColumn( name: "Coordinates", table: "GeoPoints", type: "jsonb", nullable: true); migrationBuilder.AddColumn( name: "GeometryType", table: "GeoPoints", type: "integer", nullable: false, defaultValue: 0); migrationBuilder.AddPrimaryKey( name: "PK_ProgrammeBlock", table: "ProgrammeBlock", column: "Id"); migrationBuilder.AddPrimaryKey( name: "PK_EventAgenda", table: "EventAgenda", column: "Id"); migrationBuilder.AddForeignKey( name: "FK_EventAgenda_Resources_ResourceId", table: "EventAgenda", column: "ResourceId", principalTable: "Resources", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_EventAgenda_Sections_SectionAgendaId", table: "EventAgenda", column: "SectionAgendaId", principalTable: "Sections", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_EventAgenda_Sections_SectionEventId", table: "EventAgenda", column: "SectionEventId", principalTable: "Sections", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_MapAnnotation_ProgrammeBlock_ProgrammeBlockId", table: "MapAnnotation", column: "ProgrammeBlockId", principalTable: "ProgrammeBlock", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_ProgrammeBlock_Sections_SectionEventId", table: "ProgrammeBlock", column: "SectionEventId", principalTable: "Sections", principalColumn: "Id"); } } }