474 lines
18 KiB
C#
474 lines
18 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using ManagerService.DTOs;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace ManagerService.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddedApplicationInstanceAndMisc : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
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<string>(
|
|
name: "SectionEventId",
|
|
table: "GeoPoints",
|
|
type: "text",
|
|
nullable: true);
|
|
|
|
migrationBuilder.RenameColumn(
|
|
name: "Latitude",
|
|
table: "GeoPoints",
|
|
newName: "PolyColor");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "Discriminator",
|
|
table: "Sections",
|
|
type: "character varying(13)",
|
|
maxLength: 13,
|
|
nullable: false,
|
|
oldClrType: typeof(string),
|
|
oldType: "character varying(8)",
|
|
oldMaxLength: 8);
|
|
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "EndDate",
|
|
table: "Sections",
|
|
type: "timestamp with time zone",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "IsSlidingPuzzle",
|
|
table: "Sections",
|
|
type: "boolean",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<List<string>>(
|
|
name: "ParcoursIds",
|
|
table: "Sections",
|
|
type: "jsonb",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "StartDate",
|
|
table: "Sections",
|
|
type: "timestamp with time zone",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "isActive",
|
|
table: "Sections",
|
|
type: "boolean",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "IsMobile",
|
|
table: "Instances",
|
|
type: "boolean",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "IsPushNotification",
|
|
table: "Instances",
|
|
type: "boolean",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "IsStatistic",
|
|
table: "Instances",
|
|
type: "boolean",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "IsTablet",
|
|
table: "Instances",
|
|
type: "boolean",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "IsVR",
|
|
table: "Instances",
|
|
type: "boolean",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "Coordinates",
|
|
table: "GeoPoints",
|
|
type: "jsonb",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "GeometryType",
|
|
table: "GeoPoints",
|
|
type: "integer",
|
|
nullable: false,
|
|
defaultValue: 0);
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "GuidedPaths",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<string>(type: "text", nullable: false),
|
|
InstanceId = table.Column<string>(type: "text", nullable: false),
|
|
Title = table.Column<string>(type: "jsonb", nullable: false),
|
|
Description = table.Column<string>(type: "jsonb", nullable: true),
|
|
SectionMapId = table.Column<string>(type: "text", nullable: true),
|
|
SectionEventId = table.Column<string>(type: "text", nullable: true),
|
|
IsLinear = table.Column<bool>(type: "boolean", nullable: false),
|
|
RequireSuccessToAdvance = table.Column<bool>(type: "boolean", nullable: false),
|
|
HideNextStepsUntilComplete = table.Column<bool>(type: "boolean", nullable: false),
|
|
Order = table.Column<int>(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<string>(type: "text", nullable: false),
|
|
Title = table.Column<List<TranslationDTO>>(type: "jsonb", nullable: true),
|
|
Description = table.Column<List<TranslationDTO>>(type: "jsonb", nullable: true),
|
|
StartTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
EndTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
SectionEventId = table.Column<string>(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<string>(type: "text", nullable: false),
|
|
type = table.Column<int>(type: "integer", nullable: false),
|
|
label = table.Column<string>(type: "text", nullable: true),
|
|
url = table.Column<string>(type: "text", nullable: true),
|
|
dateCreation = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
instanceId = table.Column<string>(type: "text", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_ResourceDTO", x => x.id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "GuidedSteps",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<string>(type: "text", nullable: false),
|
|
GuidedPathId = table.Column<string>(type: "text", nullable: false),
|
|
Order = table.Column<int>(type: "integer", nullable: false),
|
|
Title = table.Column<string>(type: "jsonb", nullable: false),
|
|
Description = table.Column<string>(type: "jsonb", nullable: true),
|
|
GeometryType = table.Column<int>(type: "integer", nullable: false),
|
|
Coordinates = table.Column<string>(type: "jsonb", nullable: true),
|
|
ZoneRadiusMeters = table.Column<double>(type: "double precision", nullable: true),
|
|
ImageUrl = table.Column<string>(type: "text", nullable: true),
|
|
TriggerGeoPointId = table.Column<int>(type: "integer", nullable: true),
|
|
IsHiddenInitially = table.Column<bool>(type: "boolean", nullable: false),
|
|
ValidationQuestionType = table.Column<int>(type: "integer", nullable: false),
|
|
ValidationQuestion = table.Column<string>(type: "jsonb", nullable: true),
|
|
ExpectedAnswer = table.Column<string>(type: "jsonb", nullable: true),
|
|
MultipleChoiceOptions = table.Column<string>(type: "jsonb", nullable: true),
|
|
IsStepTimer = table.Column<bool>(type: "boolean", nullable: false),
|
|
IsStepLocked = table.Column<bool>(type: "boolean", nullable: false),
|
|
TimerSeconds = table.Column<int>(type: "integer", nullable: true),
|
|
TimerExpiredMessage = table.Column<string>(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<string>(type: "text", nullable: false),
|
|
Type = table.Column<List<TranslationDTO>>(type: "jsonb", nullable: true),
|
|
Label = table.Column<List<TranslationDTO>>(type: "jsonb", nullable: true),
|
|
GeometryType = table.Column<int>(type: "integer", nullable: false),
|
|
Coordinates = table.Column<string>(type: "jsonb", nullable: true),
|
|
Icon = table.Column<string>(type: "text", nullable: true),
|
|
IconResourceDTOid = table.Column<string>(type: "text", nullable: true),
|
|
ProgrammeBlockId = table.Column<string>(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");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
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<string>(
|
|
name: "Discriminator",
|
|
table: "Sections",
|
|
type: "character varying(8)",
|
|
maxLength: 8,
|
|
nullable: false,
|
|
oldClrType: typeof(string),
|
|
oldType: "character varying(13)",
|
|
oldMaxLength: 13);
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "IsDate",
|
|
table: "Configurations",
|
|
type: "boolean",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "IsHour",
|
|
table: "Configurations",
|
|
type: "boolean",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "IsMobile",
|
|
table: "Configurations",
|
|
type: "boolean",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "IsSectionImageBackground",
|
|
table: "Configurations",
|
|
type: "boolean",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "IsTablet",
|
|
table: "Configurations",
|
|
type: "boolean",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "RoundedValue",
|
|
table: "Configurations",
|
|
type: "integer",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "ScreenPercentageSectionsMainPage",
|
|
table: "Configurations",
|
|
type: "integer",
|
|
nullable: true);
|
|
}
|
|
}
|
|
}
|