using System; using System.Collections.Generic; using ManagerService.DTOs; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace ManagerService.Migrations { /// public partial class AddedApplicationInstanceAndMisc : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "IsDate", table: "Configurations"); migrationBuilder.DropColumn( name: "IsHour", table: "Configurations"); migrationBuilder.DropColumn( name: "IsMobile", table: "Configurations"); migrationBuilder.DropColumn( name: "IsSectionImageBackground", table: "Configurations"); migrationBuilder.DropColumn( name: "IsTablet", table: "Configurations"); migrationBuilder.DropColumn( name: "RoundedValue", table: "Configurations"); migrationBuilder.DropColumn( name: "ScreenPercentageSectionsMainPage", table: "Configurations"); migrationBuilder.DropColumn( name: "Longitude", table: "GeoPoints"); migrationBuilder.AddColumn( name: "SectionEventId", table: "GeoPoints", type: "text", nullable: true); migrationBuilder.RenameColumn( name: "Latitude", table: "GeoPoints", newName: "PolyColor"); migrationBuilder.AlterColumn( name: "Discriminator", table: "Sections", type: "character varying(13)", maxLength: 13, nullable: false, oldClrType: typeof(string), oldType: "character varying(8)", oldMaxLength: 8); migrationBuilder.AddColumn( name: "EndDate", table: "Sections", type: "timestamp with time zone", nullable: true); migrationBuilder.AddColumn( name: "IsSlidingPuzzle", table: "Sections", type: "boolean", nullable: true); migrationBuilder.AddColumn>( name: "ParcoursIds", table: "Sections", type: "jsonb", nullable: true); migrationBuilder.AddColumn( name: "StartDate", table: "Sections", type: "timestamp with time zone", nullable: true); migrationBuilder.AddColumn( name: "isActive", table: "Sections", type: "boolean", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsMobile", table: "Instances", type: "boolean", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsPushNotification", table: "Instances", type: "boolean", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsStatistic", table: "Instances", type: "boolean", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsTablet", table: "Instances", type: "boolean", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsVR", table: "Instances", type: "boolean", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "Coordinates", table: "GeoPoints", type: "jsonb", nullable: true); migrationBuilder.AddColumn( name: "GeometryType", table: "GeoPoints", type: "integer", nullable: false, defaultValue: 0); migrationBuilder.CreateTable( name: "GuidedPaths", columns: table => new { Id = table.Column(type: "text", nullable: false), InstanceId = table.Column(type: "text", nullable: false), Title = table.Column(type: "jsonb", nullable: false), Description = table.Column(type: "jsonb", nullable: true), SectionMapId = table.Column(type: "text", nullable: true), SectionEventId = table.Column(type: "text", nullable: true), IsLinear = table.Column(type: "boolean", nullable: false), RequireSuccessToAdvance = table.Column(type: "boolean", nullable: false), HideNextStepsUntilComplete = table.Column(type: "boolean", nullable: false), Order = table.Column(type: "integer", nullable: false) }, constraints: table => { table.PrimaryKey("PK_GuidedPaths", x => x.Id); table.ForeignKey( name: "FK_GuidedPaths_Sections_SectionEventId", column: x => x.SectionEventId, principalTable: "Sections", principalColumn: "Id"); table.ForeignKey( name: "FK_GuidedPaths_Sections_SectionMapId", column: x => x.SectionMapId, principalTable: "Sections", principalColumn: "Id"); }); migrationBuilder.CreateTable( name: "ProgrammeBlock", columns: table => new { Id = table.Column(type: "text", nullable: false), Title = table.Column>(type: "jsonb", nullable: true), Description = table.Column>(type: "jsonb", nullable: true), StartTime = table.Column(type: "timestamp with time zone", nullable: false), EndTime = table.Column(type: "timestamp with time zone", nullable: false), SectionEventId = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_ProgrammeBlock", x => x.Id); table.ForeignKey( name: "FK_ProgrammeBlock_Sections_SectionEventId", column: x => x.SectionEventId, principalTable: "Sections", principalColumn: "Id"); }); migrationBuilder.CreateTable( name: "ResourceDTO", columns: table => new { id = table.Column(type: "text", nullable: false), type = table.Column(type: "integer", nullable: false), label = table.Column(type: "text", nullable: true), url = table.Column(type: "text", nullable: true), dateCreation = table.Column(type: "timestamp with time zone", nullable: false), instanceId = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_ResourceDTO", x => x.id); }); migrationBuilder.CreateTable( name: "GuidedSteps", columns: table => new { Id = table.Column(type: "text", nullable: false), GuidedPathId = table.Column(type: "text", nullable: false), Order = table.Column(type: "integer", nullable: false), Title = table.Column(type: "jsonb", nullable: false), Description = table.Column(type: "jsonb", nullable: true), GeometryType = table.Column(type: "integer", nullable: false), Coordinates = table.Column(type: "jsonb", nullable: true), ZoneRadiusMeters = table.Column(type: "double precision", nullable: true), ImageUrl = table.Column(type: "text", nullable: true), TriggerGeoPointId = table.Column(type: "integer", nullable: true), IsHiddenInitially = table.Column(type: "boolean", nullable: false), ValidationQuestionType = table.Column(type: "integer", nullable: false), ValidationQuestion = table.Column(type: "jsonb", nullable: true), ExpectedAnswer = table.Column(type: "jsonb", nullable: true), MultipleChoiceOptions = table.Column(type: "jsonb", nullable: true), IsStepTimer = table.Column(type: "boolean", nullable: false), IsStepLocked = table.Column(type: "boolean", nullable: false), TimerSeconds = table.Column(type: "integer", nullable: true), TimerExpiredMessage = table.Column(type: "jsonb", nullable: true) }, constraints: table => { table.PrimaryKey("PK_GuidedSteps", x => x.Id); table.ForeignKey( name: "FK_GuidedSteps_GeoPoints_TriggerGeoPointId", column: x => x.TriggerGeoPointId, principalTable: "GeoPoints", principalColumn: "Id"); table.ForeignKey( name: "FK_GuidedSteps_GuidedPaths_GuidedPathId", column: x => x.GuidedPathId, principalTable: "GuidedPaths", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "MapAnnotation", columns: table => new { Id = table.Column(type: "text", nullable: false), Type = table.Column>(type: "jsonb", nullable: true), Label = table.Column>(type: "jsonb", nullable: true), GeometryType = table.Column(type: "integer", nullable: false), Coordinates = table.Column(type: "jsonb", nullable: true), Icon = table.Column(type: "text", nullable: true), IconResourceDTOid = table.Column(type: "text", nullable: true), ProgrammeBlockId = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_MapAnnotation", x => x.Id); table.ForeignKey( name: "FK_MapAnnotation_ProgrammeBlock_ProgrammeBlockId", column: x => x.ProgrammeBlockId, principalTable: "ProgrammeBlock", principalColumn: "Id"); table.ForeignKey( name: "FK_MapAnnotation_ResourceDTO_IconResourceDTOid", column: x => x.IconResourceDTOid, principalTable: "ResourceDTO", principalColumn: "id"); }); migrationBuilder.CreateIndex( name: "IX_GeoPoints_SectionEventId", table: "GeoPoints", column: "SectionEventId"); migrationBuilder.CreateIndex( name: "IX_GuidedPaths_SectionEventId", table: "GuidedPaths", column: "SectionEventId"); migrationBuilder.CreateIndex( name: "IX_GuidedPaths_SectionMapId", table: "GuidedPaths", column: "SectionMapId"); migrationBuilder.CreateIndex( name: "IX_GuidedSteps_GuidedPathId", table: "GuidedSteps", column: "GuidedPathId"); migrationBuilder.CreateIndex( name: "IX_GuidedSteps_TriggerGeoPointId", table: "GuidedSteps", column: "TriggerGeoPointId"); migrationBuilder.CreateIndex( name: "IX_MapAnnotation_IconResourceDTOid", table: "MapAnnotation", column: "IconResourceDTOid"); migrationBuilder.CreateIndex( name: "IX_MapAnnotation_ProgrammeBlockId", table: "MapAnnotation", column: "ProgrammeBlockId"); migrationBuilder.CreateIndex( name: "IX_ProgrammeBlock_SectionEventId", table: "ProgrammeBlock", column: "SectionEventId"); migrationBuilder.AddForeignKey( name: "FK_GeoPoints_Sections_SectionEventId", table: "GeoPoints", column: "SectionEventId", principalTable: "Sections", principalColumn: "Id"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_GeoPoints_Sections_SectionEventId", table: "GeoPoints"); migrationBuilder.DropTable( name: "GuidedSteps"); migrationBuilder.DropTable( name: "MapAnnotation"); migrationBuilder.DropTable( name: "GuidedPaths"); migrationBuilder.DropTable( name: "ProgrammeBlock"); migrationBuilder.DropTable( name: "ResourceDTO"); migrationBuilder.DropIndex( name: "IX_GeoPoints_SectionEventId", table: "GeoPoints"); migrationBuilder.DropColumn( name: "EndDate", table: "Sections"); migrationBuilder.DropColumn( name: "IsSlidingPuzzle", table: "Sections"); migrationBuilder.DropColumn( name: "ParcoursIds", table: "Sections"); migrationBuilder.DropColumn( name: "StartDate", table: "Sections"); migrationBuilder.DropColumn( name: "isActive", table: "Sections"); migrationBuilder.DropColumn( name: "IsMobile", table: "Instances"); migrationBuilder.DropColumn( name: "IsPushNotification", table: "Instances"); migrationBuilder.DropColumn( name: "IsStatistic", table: "Instances"); migrationBuilder.DropColumn( name: "IsTablet", table: "Instances"); migrationBuilder.DropColumn( name: "IsVR", table: "Instances"); migrationBuilder.DropColumn( name: "Coordinates", table: "GeoPoints"); migrationBuilder.DropColumn( name: "GeometryType", table: "GeoPoints"); migrationBuilder.RenameColumn( name: "SectionEventId", table: "GeoPoints", newName: "Longitude"); migrationBuilder.RenameColumn( name: "PolyColor", table: "GeoPoints", newName: "Latitude"); migrationBuilder.AlterColumn( name: "Discriminator", table: "Sections", type: "character varying(8)", maxLength: 8, nullable: false, oldClrType: typeof(string), oldType: "character varying(13)", oldMaxLength: 13); migrationBuilder.AddColumn( name: "IsDate", table: "Configurations", type: "boolean", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsHour", table: "Configurations", type: "boolean", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsMobile", table: "Configurations", type: "boolean", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsSectionImageBackground", table: "Configurations", type: "boolean", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "IsTablet", table: "Configurations", type: "boolean", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "RoundedValue", table: "Configurations", type: "integer", nullable: true); migrationBuilder.AddColumn( name: "ScreenPercentageSectionsMainPage", table: "Configurations", type: "integer", nullable: true); } } }