// using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using Server; #nullable disable namespace Server.Migrations { [DbContext(typeof(SpaceRaceDbContext))] [Migration("20230829062456_Beginninging")] partial class Beginninging { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "7.0.10") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("Server.Lap", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("Created") .HasColumnType("timestamp with time zone"); b.Property("Map") .IsRequired() .HasColumnType("text"); b.Property("Time") .HasColumnType("double precision"); b.Property("UserId") .HasColumnType("uuid"); b.HasKey("Id"); b.HasIndex("Map"); b.HasIndex("UserId", "Map") .IsUnique(); b.ToTable("Laps"); b.HasData( new { Id = new Guid("42ee5177-d287-4ea1-91ed-ddd1d596e81f"), Created = new DateTimeOffset(new DateTime(2023, 8, 29, 6, 24, 56, 272, DateTimeKind.Unspecified).AddTicks(1375), new TimeSpan(0, 0, 0, 0, 0)), Map = "sr_TestTrack", Time = 128.0, UserId = new Guid("11111111-1111-1111-1111-111111111111") }, new { Id = new Guid("81eb5dcb-1dd4-483b-993e-e73e1b95c5ff"), Created = new DateTimeOffset(new DateTime(2023, 8, 29, 6, 24, 56, 272, DateTimeKind.Unspecified).AddTicks(1459), new TimeSpan(0, 0, 0, 0, 0)), Map = "sr_TestTrack", Time = 132.0, UserId = new Guid("22222222-2222-2222-2222-222222222222") }, new { Id = new Guid("69002b76-54e2-455f-99aa-2fdb7f11c130"), Created = new DateTimeOffset(new DateTime(2023, 8, 29, 6, 24, 56, 272, DateTimeKind.Unspecified).AddTicks(1471), new TimeSpan(0, 0, 0, 0, 0)), Map = "sr_TestTrack", Time = 148.0, UserId = new Guid("33333333-3333-3333-3333-333333333333") }); }); modelBuilder.Entity("SpaceRace.Shared.PbDTO", b => { b.Property("Completions") .HasColumnType("integer"); b.Property("Created") .HasColumnType("timestamp with time zone"); b.Property("Id") .HasColumnType("uuid"); b.Property("Map") .HasColumnType("text"); b.Property("Position") .HasColumnType("integer"); b.Property("Time") .HasColumnType("double precision"); b.Property("UserId") .HasColumnType("uuid"); b.ToTable("PbDTO"); b.ToSqlQuery("WITH ranked AS (\n SELECT *, rank() OVER (ORDER BY \"Time\" ASC) AS \"Position\", COUNT(\"Id\") OVER () AS \"Completions\"\n FROM \"Laps\"\n)\n\nSELECT * FROM ranked"); }); #pragma warning restore 612, 618 } } }