From f3c855ae01bb0d21497094d94481a30bfd74a0c0 Mon Sep 17 00:00:00 2001 From: Debug <49997488+DebugOk@users.noreply.github.com> Date: Sun, 24 Dec 2023 07:29:53 +0100 Subject: [PATCH] 1984 jsonb Hopefully this works? I dunno, I'm just trying stuff because I'm bored --- .../20231224062823_NoJson.Designer.cs | 596 ++++++++++++++++++ .../Migrations/20231224062823_NoJson.cs | 99 +++ .../Migrations/ContextModelSnapshot.cs | 385 ++++++++++- SS14.MapServer/Models/Entities/Map.cs | 1 - 4 files changed, 1054 insertions(+), 27 deletions(-) create mode 100644 SS14.MapServer/Migrations/20231224062823_NoJson.Designer.cs create mode 100644 SS14.MapServer/Migrations/20231224062823_NoJson.cs diff --git a/SS14.MapServer/Migrations/20231224062823_NoJson.Designer.cs b/SS14.MapServer/Migrations/20231224062823_NoJson.Designer.cs new file mode 100644 index 0000000..175a4b4 --- /dev/null +++ b/SS14.MapServer/Migrations/20231224062823_NoJson.Designer.cs @@ -0,0 +1,596 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using SS14.MapServer.Models; + +#nullable disable + +namespace SS14.MapServer.Migrations +{ + [DbContext(typeof(Context))] + [Migration("20231224062823_NoJson")] + partial class NoJson + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("SS14.MapServer.Models.Entities.Grid", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("GridId") + .HasColumnType("integer"); + + b.Property("MapGuid") + .HasColumnType("uuid"); + + b.Property("Path") + .IsRequired() + .HasColumnType("text"); + + b.Property("TileSize") + .HasColumnType("integer"); + + b.Property("Tiled") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("GridId"); + + b.HasIndex("MapGuid"); + + b.ToTable("Grid"); + }); + + modelBuilder.Entity("SS14.MapServer.Models.Entities.ImageFile", b => + { + b.Property("Path") + .HasColumnType("text"); + + b.Property("InternalPath") + .IsRequired() + .HasColumnType("text"); + + b.Property("LastUpdated") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.HasKey("Path"); + + b.ToTable("Image"); + }); + + modelBuilder.Entity("SS14.MapServer.Models.Entities.Map", b => + { + b.Property("MapGuid") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Attribution") + .HasColumnType("text"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnType("text"); + + b.Property("GitRef") + .IsRequired() + .HasColumnType("text"); + + b.Property("LastUpdated") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("MapId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("MapGuid"); + + b.HasIndex("GitRef"); + + b.HasIndex("GitRef", "MapId") + .IsUnique(); + + b.ToTable("Map"); + }); + + modelBuilder.Entity("SS14.MapServer.Models.Entities.PullRequestComment", b => + { + b.Property("Owner") + .HasColumnType("text"); + + b.Property("Repository") + .HasColumnType("text"); + + b.Property("IssueNumber") + .HasColumnType("integer"); + + b.Property("CommentId") + .HasColumnType("integer"); + + b.HasKey("Owner", "Repository", "IssueNumber"); + + b.ToTable("PullRequestComment"); + }); + + modelBuilder.Entity("SS14.MapServer.Models.Entities.Tile", b => + { + b.Property("MapGuid") + .HasColumnType("uuid"); + + b.Property("GridId") + .HasColumnType("integer"); + + b.Property("X") + .HasColumnType("integer"); + + b.Property("Y") + .HasColumnType("integer"); + + b.Property("Path") + .IsRequired() + .HasColumnType("text"); + + b.Property("Size") + .HasColumnType("integer"); + + b.HasKey("MapGuid", "GridId", "X", "Y"); + + b.HasIndex("MapGuid", "GridId"); + + b.ToTable("Tile"); + }); + + modelBuilder.Entity("SS14.MapServer.Models.Entities.Grid", b => + { + b.HasOne("SS14.MapServer.Models.Entities.Map", null) + .WithMany("Grids") + .HasForeignKey("MapGuid"); + + b.OwnsOne("SS14.MapServer.Models.Types.Area", "Extent", b1 => + { + b1.Property("GridId") + .HasColumnType("uuid"); + + b1.HasKey("GridId"); + + b1.ToTable("Grid"); + + b1.WithOwner() + .HasForeignKey("GridId"); + + b1.OwnsOne("SS14.MapServer.Models.Types.Point", "A", b2 => + { + b2.Property("AreaGridId") + .HasColumnType("uuid"); + + b2.Property("X") + .HasColumnType("real"); + + b2.Property("Y") + .HasColumnType("real"); + + b2.HasKey("AreaGridId"); + + b2.ToTable("Grid"); + + b2.WithOwner() + .HasForeignKey("AreaGridId"); + }); + + b1.OwnsOne("SS14.MapServer.Models.Types.Point", "B", b2 => + { + b2.Property("AreaGridId") + .HasColumnType("uuid"); + + b2.Property("X") + .HasColumnType("real"); + + b2.Property("Y") + .HasColumnType("real"); + + b2.HasKey("AreaGridId"); + + b2.ToTable("Grid"); + + b2.WithOwner() + .HasForeignKey("AreaGridId"); + }); + + b1.Navigation("A") + .IsRequired(); + + b1.Navigation("B") + .IsRequired(); + }); + + b.OwnsOne("SS14.MapServer.Models.Types.Point", "Offset", b1 => + { + b1.Property("GridId") + .HasColumnType("uuid"); + + b1.Property("X") + .HasColumnType("real"); + + b1.Property("Y") + .HasColumnType("real"); + + b1.HasKey("GridId"); + + b1.ToTable("Grid"); + + b1.WithOwner() + .HasForeignKey("GridId"); + }); + + b.Navigation("Extent") + .IsRequired(); + + b.Navigation("Offset") + .IsRequired(); + }); + + modelBuilder.Entity("SS14.MapServer.Models.Entities.Map", b => + { + b.OwnsMany("SS14.MapServer.Models.Types.ParallaxLayer", "ParallaxLayers", b1 => + { + b1.Property("MapGuid") + .HasColumnType("uuid"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b1.Property("Id")); + + b1.Property("MinScale") + .HasColumnType("real"); + + b1.Property("Static") + .HasColumnType("boolean"); + + b1.HasKey("MapGuid", "Id"); + + b1.ToTable("ParallaxLayer"); + + b1.WithOwner() + .HasForeignKey("MapGuid"); + + b1.OwnsMany("SS14.MapServer.Models.Types.LayerSource", "Layers", b2 => + { + b2.Property("ParallaxLayerMapGuid") + .HasColumnType("uuid"); + + b2.Property("ParallaxLayerId") + .HasColumnType("integer"); + + b2.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b2.Property("Id")); + + b2.Property("Composition") + .IsRequired() + .HasColumnType("text"); + + b2.Property("Url") + .IsRequired() + .HasColumnType("text"); + + b2.HasKey("ParallaxLayerMapGuid", "ParallaxLayerId", "Id"); + + b2.ToTable("ParallaxLayer_Layers"); + + b2.WithOwner() + .HasForeignKey("ParallaxLayerMapGuid", "ParallaxLayerId"); + + b2.OwnsOne("SS14.MapServer.Models.Types.Area", "Extent", b3 => + { + b3.Property("LayerSourceParallaxLayerMapGuid") + .HasColumnType("uuid"); + + b3.Property("LayerSourceParallaxLayerId") + .HasColumnType("integer"); + + b3.Property("LayerSourceId") + .HasColumnType("integer"); + + b3.HasKey("LayerSourceParallaxLayerMapGuid", "LayerSourceParallaxLayerId", "LayerSourceId"); + + b3.ToTable("ParallaxLayer_Layers"); + + b3.WithOwner() + .HasForeignKey("LayerSourceParallaxLayerMapGuid", "LayerSourceParallaxLayerId", "LayerSourceId"); + + b3.OwnsOne("SS14.MapServer.Models.Types.Point", "A", b4 => + { + b4.Property("AreaLayerSourceParallaxLayerMapGuid") + .HasColumnType("uuid"); + + b4.Property("AreaLayerSourceParallaxLayerId") + .HasColumnType("integer"); + + b4.Property("AreaLayerSourceId") + .HasColumnType("integer"); + + b4.Property("X") + .HasColumnType("real"); + + b4.Property("Y") + .HasColumnType("real"); + + b4.HasKey("AreaLayerSourceParallaxLayerMapGuid", "AreaLayerSourceParallaxLayerId", "AreaLayerSourceId"); + + b4.ToTable("ParallaxLayer_Layers"); + + b4.WithOwner() + .HasForeignKey("AreaLayerSourceParallaxLayerMapGuid", "AreaLayerSourceParallaxLayerId", "AreaLayerSourceId"); + }); + + b3.OwnsOne("SS14.MapServer.Models.Types.Point", "B", b4 => + { + b4.Property("AreaLayerSourceParallaxLayerMapGuid") + .HasColumnType("uuid"); + + b4.Property("AreaLayerSourceParallaxLayerId") + .HasColumnType("integer"); + + b4.Property("AreaLayerSourceId") + .HasColumnType("integer"); + + b4.Property("X") + .HasColumnType("real"); + + b4.Property("Y") + .HasColumnType("real"); + + b4.HasKey("AreaLayerSourceParallaxLayerMapGuid", "AreaLayerSourceParallaxLayerId", "AreaLayerSourceId"); + + b4.ToTable("ParallaxLayer_Layers"); + + b4.WithOwner() + .HasForeignKey("AreaLayerSourceParallaxLayerMapGuid", "AreaLayerSourceParallaxLayerId", "AreaLayerSourceId"); + }); + + b3.Navigation("A") + .IsRequired(); + + b3.Navigation("B") + .IsRequired(); + }); + + b2.OwnsOne("SS14.MapServer.Models.Types.Point", "ParallaxScale", b3 => + { + b3.Property("LayerSourceParallaxLayerMapGuid") + .HasColumnType("uuid"); + + b3.Property("LayerSourceParallaxLayerId") + .HasColumnType("integer"); + + b3.Property("LayerSourceId") + .HasColumnType("integer"); + + b3.Property("X") + .HasColumnType("real"); + + b3.Property("Y") + .HasColumnType("real"); + + b3.HasKey("LayerSourceParallaxLayerMapGuid", "LayerSourceParallaxLayerId", "LayerSourceId"); + + b3.ToTable("ParallaxLayer_Layers"); + + b3.WithOwner() + .HasForeignKey("LayerSourceParallaxLayerMapGuid", "LayerSourceParallaxLayerId", "LayerSourceId"); + }); + + b2.Navigation("Extent") + .IsRequired(); + + b2.Navigation("ParallaxScale") + .IsRequired(); + }); + + b1.OwnsOne("SS14.MapServer.Models.Types.Point", "Offset", b2 => + { + b2.Property("ParallaxLayerMapGuid") + .HasColumnType("uuid"); + + b2.Property("ParallaxLayerId") + .HasColumnType("integer"); + + b2.Property("X") + .HasColumnType("real"); + + b2.Property("Y") + .HasColumnType("real"); + + b2.HasKey("ParallaxLayerMapGuid", "ParallaxLayerId"); + + b2.ToTable("ParallaxLayer"); + + b2.WithOwner() + .HasForeignKey("ParallaxLayerMapGuid", "ParallaxLayerId"); + }); + + b1.OwnsOne("SS14.MapServer.Models.Types.Point", "Scale", b2 => + { + b2.Property("ParallaxLayerMapGuid") + .HasColumnType("uuid"); + + b2.Property("ParallaxLayerId") + .HasColumnType("integer"); + + b2.Property("X") + .HasColumnType("real"); + + b2.Property("Y") + .HasColumnType("real"); + + b2.HasKey("ParallaxLayerMapGuid", "ParallaxLayerId"); + + b2.ToTable("ParallaxLayer"); + + b2.WithOwner() + .HasForeignKey("ParallaxLayerMapGuid", "ParallaxLayerId"); + }); + + b1.OwnsOne("SS14.MapServer.Models.Types.LayerSource", "Source", b2 => + { + b2.Property("ParallaxLayerMapGuid") + .HasColumnType("uuid"); + + b2.Property("ParallaxLayerId") + .HasColumnType("integer"); + + b2.Property("Composition") + .IsRequired() + .HasColumnType("text"); + + b2.Property("Url") + .IsRequired() + .HasColumnType("text"); + + b2.HasKey("ParallaxLayerMapGuid", "ParallaxLayerId"); + + b2.ToTable("ParallaxLayer"); + + b2.WithOwner() + .HasForeignKey("ParallaxLayerMapGuid", "ParallaxLayerId"); + + b2.OwnsOne("SS14.MapServer.Models.Types.Area", "Extent", b3 => + { + b3.Property("LayerSourceParallaxLayerMapGuid") + .HasColumnType("uuid"); + + b3.Property("LayerSourceParallaxLayerId") + .HasColumnType("integer"); + + b3.HasKey("LayerSourceParallaxLayerMapGuid", "LayerSourceParallaxLayerId"); + + b3.ToTable("ParallaxLayer"); + + b3.WithOwner() + .HasForeignKey("LayerSourceParallaxLayerMapGuid", "LayerSourceParallaxLayerId"); + + b3.OwnsOne("SS14.MapServer.Models.Types.Point", "A", b4 => + { + b4.Property("AreaLayerSourceParallaxLayerMapGuid") + .HasColumnType("uuid"); + + b4.Property("AreaLayerSourceParallaxLayerId") + .HasColumnType("integer"); + + b4.Property("X") + .HasColumnType("real"); + + b4.Property("Y") + .HasColumnType("real"); + + b4.HasKey("AreaLayerSourceParallaxLayerMapGuid", "AreaLayerSourceParallaxLayerId"); + + b4.ToTable("ParallaxLayer"); + + b4.WithOwner() + .HasForeignKey("AreaLayerSourceParallaxLayerMapGuid", "AreaLayerSourceParallaxLayerId"); + }); + + b3.OwnsOne("SS14.MapServer.Models.Types.Point", "B", b4 => + { + b4.Property("AreaLayerSourceParallaxLayerMapGuid") + .HasColumnType("uuid"); + + b4.Property("AreaLayerSourceParallaxLayerId") + .HasColumnType("integer"); + + b4.Property("X") + .HasColumnType("real"); + + b4.Property("Y") + .HasColumnType("real"); + + b4.HasKey("AreaLayerSourceParallaxLayerMapGuid", "AreaLayerSourceParallaxLayerId"); + + b4.ToTable("ParallaxLayer"); + + b4.WithOwner() + .HasForeignKey("AreaLayerSourceParallaxLayerMapGuid", "AreaLayerSourceParallaxLayerId"); + }); + + b3.Navigation("A") + .IsRequired(); + + b3.Navigation("B") + .IsRequired(); + }); + + b2.OwnsOne("SS14.MapServer.Models.Types.Point", "ParallaxScale", b3 => + { + b3.Property("LayerSourceParallaxLayerMapGuid") + .HasColumnType("uuid"); + + b3.Property("LayerSourceParallaxLayerId") + .HasColumnType("integer"); + + b3.Property("X") + .HasColumnType("real"); + + b3.Property("Y") + .HasColumnType("real"); + + b3.HasKey("LayerSourceParallaxLayerMapGuid", "LayerSourceParallaxLayerId"); + + b3.ToTable("ParallaxLayer"); + + b3.WithOwner() + .HasForeignKey("LayerSourceParallaxLayerMapGuid", "LayerSourceParallaxLayerId"); + }); + + b2.Navigation("Extent") + .IsRequired(); + + b2.Navigation("ParallaxScale") + .IsRequired(); + }); + + b1.Navigation("Layers"); + + b1.Navigation("Offset") + .IsRequired(); + + b1.Navigation("Scale") + .IsRequired(); + + b1.Navigation("Source") + .IsRequired(); + }); + + b.Navigation("ParallaxLayers"); + }); + + modelBuilder.Entity("SS14.MapServer.Models.Entities.Map", b => + { + b.Navigation("Grids"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/SS14.MapServer/Migrations/20231224062823_NoJson.cs b/SS14.MapServer/Migrations/20231224062823_NoJson.cs new file mode 100644 index 0000000..8f01251 --- /dev/null +++ b/SS14.MapServer/Migrations/20231224062823_NoJson.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using SS14.MapServer.Models.Types; + +#nullable disable + +namespace SS14.MapServer.Migrations +{ + /// + public partial class NoJson : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ParallaxLayers", + table: "Map"); + + migrationBuilder.CreateTable( + name: "ParallaxLayer", + columns: table => new + { + MapGuid = table.Column(type: "uuid", nullable: false), + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Scale_X = table.Column(type: "real", nullable: false), + Scale_Y = table.Column(type: "real", nullable: false), + Offset_X = table.Column(type: "real", nullable: false), + Offset_Y = table.Column(type: "real", nullable: false), + Static = table.Column(type: "boolean", nullable: false), + MinScale = table.Column(type: "real", nullable: true), + Source_Url = table.Column(type: "text", nullable: false), + Source_Extent_A_X = table.Column(type: "real", nullable: false), + Source_Extent_A_Y = table.Column(type: "real", nullable: false), + Source_Extent_B_X = table.Column(type: "real", nullable: false), + Source_Extent_B_Y = table.Column(type: "real", nullable: false), + Source_Composition = table.Column(type: "text", nullable: false), + Source_ParallaxScale_X = table.Column(type: "real", nullable: false), + Source_ParallaxScale_Y = table.Column(type: "real", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ParallaxLayer", x => new { x.MapGuid, x.Id }); + table.ForeignKey( + name: "FK_ParallaxLayer_Map_MapGuid", + column: x => x.MapGuid, + principalTable: "Map", + principalColumn: "MapGuid", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ParallaxLayer_Layers", + columns: table => new + { + ParallaxLayerMapGuid = table.Column(type: "uuid", nullable: false), + ParallaxLayerId = table.Column(type: "integer", nullable: false), + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Url = table.Column(type: "text", nullable: false), + Extent_A_X = table.Column(type: "real", nullable: false), + Extent_A_Y = table.Column(type: "real", nullable: false), + Extent_B_X = table.Column(type: "real", nullable: false), + Extent_B_Y = table.Column(type: "real", nullable: false), + Composition = table.Column(type: "text", nullable: false), + ParallaxScale_X = table.Column(type: "real", nullable: false), + ParallaxScale_Y = table.Column(type: "real", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ParallaxLayer_Layers", x => new { x.ParallaxLayerMapGuid, x.ParallaxLayerId, x.Id }); + table.ForeignKey( + name: "FK_ParallaxLayer_Layers_ParallaxLayer_ParallaxLayerMapGuid_Par~", + columns: x => new { x.ParallaxLayerMapGuid, x.ParallaxLayerId }, + principalTable: "ParallaxLayer", + principalColumns: new[] { "MapGuid", "Id" }, + onDelete: ReferentialAction.Cascade); + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ParallaxLayer_Layers"); + + migrationBuilder.DropTable( + name: "ParallaxLayer"); + + migrationBuilder.AddColumn>( + name: "ParallaxLayers", + table: "Map", + type: "jsonb", + nullable: false); + } + } +} diff --git a/SS14.MapServer/Migrations/ContextModelSnapshot.cs b/SS14.MapServer/Migrations/ContextModelSnapshot.cs index 7f22b78..d2e14cf 100644 --- a/SS14.MapServer/Migrations/ContextModelSnapshot.cs +++ b/SS14.MapServer/Migrations/ContextModelSnapshot.cs @@ -1,12 +1,10 @@ // using System; -using System.Collections.Generic; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using SS14.MapServer.Models; -using SS14.MapServer.Models.Types; #nullable disable @@ -19,7 +17,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "7.0.5") + .HasAnnotation("ProductVersion", "8.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); @@ -100,10 +98,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasColumnType("text"); - b.Property>("ParallaxLayers") - .IsRequired() - .HasColumnType("jsonb"); - b.HasKey("MapGuid"); b.HasIndex("GitRef"); @@ -167,25 +161,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) .WithMany("Grids") .HasForeignKey("MapGuid"); - b.OwnsOne("SS14.MapServer.Models.Types.Point", "Offset", b1 => - { - b1.Property("GridId") - .HasColumnType("uuid"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.HasKey("GridId"); - - b1.ToTable("Grid"); - - b1.WithOwner() - .HasForeignKey("GridId"); - }); - b.OwnsOne("SS14.MapServer.Models.Types.Area", "Extent", b1 => { b1.Property("GridId") @@ -243,6 +218,25 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired(); }); + b.OwnsOne("SS14.MapServer.Models.Types.Point", "Offset", b1 => + { + b1.Property("GridId") + .HasColumnType("uuid"); + + b1.Property("X") + .HasColumnType("real"); + + b1.Property("Y") + .HasColumnType("real"); + + b1.HasKey("GridId"); + + b1.ToTable("Grid"); + + b1.WithOwner() + .HasForeignKey("GridId"); + }); + b.Navigation("Extent") .IsRequired(); @@ -250,6 +244,345 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired(); }); + modelBuilder.Entity("SS14.MapServer.Models.Entities.Map", b => + { + b.OwnsMany("SS14.MapServer.Models.Types.ParallaxLayer", "ParallaxLayers", b1 => + { + b1.Property("MapGuid") + .HasColumnType("uuid"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b1.Property("Id")); + + b1.Property("MinScale") + .HasColumnType("real"); + + b1.Property("Static") + .HasColumnType("boolean"); + + b1.HasKey("MapGuid", "Id"); + + b1.ToTable("ParallaxLayer"); + + b1.WithOwner() + .HasForeignKey("MapGuid"); + + b1.OwnsMany("SS14.MapServer.Models.Types.LayerSource", "Layers", b2 => + { + b2.Property("ParallaxLayerMapGuid") + .HasColumnType("uuid"); + + b2.Property("ParallaxLayerId") + .HasColumnType("integer"); + + b2.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b2.Property("Id")); + + b2.Property("Composition") + .IsRequired() + .HasColumnType("text"); + + b2.Property("Url") + .IsRequired() + .HasColumnType("text"); + + b2.HasKey("ParallaxLayerMapGuid", "ParallaxLayerId", "Id"); + + b2.ToTable("ParallaxLayer_Layers"); + + b2.WithOwner() + .HasForeignKey("ParallaxLayerMapGuid", "ParallaxLayerId"); + + b2.OwnsOne("SS14.MapServer.Models.Types.Area", "Extent", b3 => + { + b3.Property("LayerSourceParallaxLayerMapGuid") + .HasColumnType("uuid"); + + b3.Property("LayerSourceParallaxLayerId") + .HasColumnType("integer"); + + b3.Property("LayerSourceId") + .HasColumnType("integer"); + + b3.HasKey("LayerSourceParallaxLayerMapGuid", "LayerSourceParallaxLayerId", "LayerSourceId"); + + b3.ToTable("ParallaxLayer_Layers"); + + b3.WithOwner() + .HasForeignKey("LayerSourceParallaxLayerMapGuid", "LayerSourceParallaxLayerId", "LayerSourceId"); + + b3.OwnsOne("SS14.MapServer.Models.Types.Point", "A", b4 => + { + b4.Property("AreaLayerSourceParallaxLayerMapGuid") + .HasColumnType("uuid"); + + b4.Property("AreaLayerSourceParallaxLayerId") + .HasColumnType("integer"); + + b4.Property("AreaLayerSourceId") + .HasColumnType("integer"); + + b4.Property("X") + .HasColumnType("real"); + + b4.Property("Y") + .HasColumnType("real"); + + b4.HasKey("AreaLayerSourceParallaxLayerMapGuid", "AreaLayerSourceParallaxLayerId", "AreaLayerSourceId"); + + b4.ToTable("ParallaxLayer_Layers"); + + b4.WithOwner() + .HasForeignKey("AreaLayerSourceParallaxLayerMapGuid", "AreaLayerSourceParallaxLayerId", "AreaLayerSourceId"); + }); + + b3.OwnsOne("SS14.MapServer.Models.Types.Point", "B", b4 => + { + b4.Property("AreaLayerSourceParallaxLayerMapGuid") + .HasColumnType("uuid"); + + b4.Property("AreaLayerSourceParallaxLayerId") + .HasColumnType("integer"); + + b4.Property("AreaLayerSourceId") + .HasColumnType("integer"); + + b4.Property("X") + .HasColumnType("real"); + + b4.Property("Y") + .HasColumnType("real"); + + b4.HasKey("AreaLayerSourceParallaxLayerMapGuid", "AreaLayerSourceParallaxLayerId", "AreaLayerSourceId"); + + b4.ToTable("ParallaxLayer_Layers"); + + b4.WithOwner() + .HasForeignKey("AreaLayerSourceParallaxLayerMapGuid", "AreaLayerSourceParallaxLayerId", "AreaLayerSourceId"); + }); + + b3.Navigation("A") + .IsRequired(); + + b3.Navigation("B") + .IsRequired(); + }); + + b2.OwnsOne("SS14.MapServer.Models.Types.Point", "ParallaxScale", b3 => + { + b3.Property("LayerSourceParallaxLayerMapGuid") + .HasColumnType("uuid"); + + b3.Property("LayerSourceParallaxLayerId") + .HasColumnType("integer"); + + b3.Property("LayerSourceId") + .HasColumnType("integer"); + + b3.Property("X") + .HasColumnType("real"); + + b3.Property("Y") + .HasColumnType("real"); + + b3.HasKey("LayerSourceParallaxLayerMapGuid", "LayerSourceParallaxLayerId", "LayerSourceId"); + + b3.ToTable("ParallaxLayer_Layers"); + + b3.WithOwner() + .HasForeignKey("LayerSourceParallaxLayerMapGuid", "LayerSourceParallaxLayerId", "LayerSourceId"); + }); + + b2.Navigation("Extent") + .IsRequired(); + + b2.Navigation("ParallaxScale") + .IsRequired(); + }); + + b1.OwnsOne("SS14.MapServer.Models.Types.Point", "Offset", b2 => + { + b2.Property("ParallaxLayerMapGuid") + .HasColumnType("uuid"); + + b2.Property("ParallaxLayerId") + .HasColumnType("integer"); + + b2.Property("X") + .HasColumnType("real"); + + b2.Property("Y") + .HasColumnType("real"); + + b2.HasKey("ParallaxLayerMapGuid", "ParallaxLayerId"); + + b2.ToTable("ParallaxLayer"); + + b2.WithOwner() + .HasForeignKey("ParallaxLayerMapGuid", "ParallaxLayerId"); + }); + + b1.OwnsOne("SS14.MapServer.Models.Types.Point", "Scale", b2 => + { + b2.Property("ParallaxLayerMapGuid") + .HasColumnType("uuid"); + + b2.Property("ParallaxLayerId") + .HasColumnType("integer"); + + b2.Property("X") + .HasColumnType("real"); + + b2.Property("Y") + .HasColumnType("real"); + + b2.HasKey("ParallaxLayerMapGuid", "ParallaxLayerId"); + + b2.ToTable("ParallaxLayer"); + + b2.WithOwner() + .HasForeignKey("ParallaxLayerMapGuid", "ParallaxLayerId"); + }); + + b1.OwnsOne("SS14.MapServer.Models.Types.LayerSource", "Source", b2 => + { + b2.Property("ParallaxLayerMapGuid") + .HasColumnType("uuid"); + + b2.Property("ParallaxLayerId") + .HasColumnType("integer"); + + b2.Property("Composition") + .IsRequired() + .HasColumnType("text"); + + b2.Property("Url") + .IsRequired() + .HasColumnType("text"); + + b2.HasKey("ParallaxLayerMapGuid", "ParallaxLayerId"); + + b2.ToTable("ParallaxLayer"); + + b2.WithOwner() + .HasForeignKey("ParallaxLayerMapGuid", "ParallaxLayerId"); + + b2.OwnsOne("SS14.MapServer.Models.Types.Area", "Extent", b3 => + { + b3.Property("LayerSourceParallaxLayerMapGuid") + .HasColumnType("uuid"); + + b3.Property("LayerSourceParallaxLayerId") + .HasColumnType("integer"); + + b3.HasKey("LayerSourceParallaxLayerMapGuid", "LayerSourceParallaxLayerId"); + + b3.ToTable("ParallaxLayer"); + + b3.WithOwner() + .HasForeignKey("LayerSourceParallaxLayerMapGuid", "LayerSourceParallaxLayerId"); + + b3.OwnsOne("SS14.MapServer.Models.Types.Point", "A", b4 => + { + b4.Property("AreaLayerSourceParallaxLayerMapGuid") + .HasColumnType("uuid"); + + b4.Property("AreaLayerSourceParallaxLayerId") + .HasColumnType("integer"); + + b4.Property("X") + .HasColumnType("real"); + + b4.Property("Y") + .HasColumnType("real"); + + b4.HasKey("AreaLayerSourceParallaxLayerMapGuid", "AreaLayerSourceParallaxLayerId"); + + b4.ToTable("ParallaxLayer"); + + b4.WithOwner() + .HasForeignKey("AreaLayerSourceParallaxLayerMapGuid", "AreaLayerSourceParallaxLayerId"); + }); + + b3.OwnsOne("SS14.MapServer.Models.Types.Point", "B", b4 => + { + b4.Property("AreaLayerSourceParallaxLayerMapGuid") + .HasColumnType("uuid"); + + b4.Property("AreaLayerSourceParallaxLayerId") + .HasColumnType("integer"); + + b4.Property("X") + .HasColumnType("real"); + + b4.Property("Y") + .HasColumnType("real"); + + b4.HasKey("AreaLayerSourceParallaxLayerMapGuid", "AreaLayerSourceParallaxLayerId"); + + b4.ToTable("ParallaxLayer"); + + b4.WithOwner() + .HasForeignKey("AreaLayerSourceParallaxLayerMapGuid", "AreaLayerSourceParallaxLayerId"); + }); + + b3.Navigation("A") + .IsRequired(); + + b3.Navigation("B") + .IsRequired(); + }); + + b2.OwnsOne("SS14.MapServer.Models.Types.Point", "ParallaxScale", b3 => + { + b3.Property("LayerSourceParallaxLayerMapGuid") + .HasColumnType("uuid"); + + b3.Property("LayerSourceParallaxLayerId") + .HasColumnType("integer"); + + b3.Property("X") + .HasColumnType("real"); + + b3.Property("Y") + .HasColumnType("real"); + + b3.HasKey("LayerSourceParallaxLayerMapGuid", "LayerSourceParallaxLayerId"); + + b3.ToTable("ParallaxLayer"); + + b3.WithOwner() + .HasForeignKey("LayerSourceParallaxLayerMapGuid", "LayerSourceParallaxLayerId"); + }); + + b2.Navigation("Extent") + .IsRequired(); + + b2.Navigation("ParallaxScale") + .IsRequired(); + }); + + b1.Navigation("Layers"); + + b1.Navigation("Offset") + .IsRequired(); + + b1.Navigation("Scale") + .IsRequired(); + + b1.Navigation("Source") + .IsRequired(); + }); + + b.Navigation("ParallaxLayers"); + }); + modelBuilder.Entity("SS14.MapServer.Models.Entities.Map", b => { b.Navigation("Grids"); diff --git a/SS14.MapServer/Models/Entities/Map.cs b/SS14.MapServer/Models/Entities/Map.cs index 19a3faa..8ba722a 100644 --- a/SS14.MapServer/Models/Entities/Map.cs +++ b/SS14.MapServer/Models/Entities/Map.cs @@ -23,7 +23,6 @@ public class Map [Required] public List Grids {get;} = new(); - [Column(TypeName = "jsonb")] public List ParallaxLayers { get; set; } = new(); [DatabaseGenerated(DatabaseGeneratedOption.Computed)]