summaryrefslogtreecommitdiffstats
path: root/api/WhatApi/Migrations
diff options
context:
space:
mode:
authorivar <i@oiee.no>2025-10-20 00:26:34 +0200
committerivar <i@oiee.no>2025-10-20 00:26:34 +0200
commita1f0518d0cd123a791adde64f4f11bd8e44276c7 (patch)
tree675a7dff8262eea877ec800ff1efe9b92f5d7e7d /api/WhatApi/Migrations
downloadwhat-a1f0518d0cd123a791adde64f4f11bd8e44276c7.tar.xz
what-a1f0518d0cd123a791adde64f4f11bd8e44276c7.zip
Initial commit
Diffstat (limited to 'api/WhatApi/Migrations')
-rw-r--r--api/WhatApi/Migrations/20251013213511_Initial.Designer.cs93
-rw-r--r--api/WhatApi/Migrations/20251013213511_Initial.cs75
-rw-r--r--api/WhatApi/Migrations/DatabaseModelSnapshot.cs90
3 files changed, 258 insertions, 0 deletions
diff --git a/api/WhatApi/Migrations/20251013213511_Initial.Designer.cs b/api/WhatApi/Migrations/20251013213511_Initial.Designer.cs
new file mode 100644
index 0000000..5ddcc9f
--- /dev/null
+++ b/api/WhatApi/Migrations/20251013213511_Initial.Designer.cs
@@ -0,0 +1,93 @@
+// <auto-generated />
+using System;
+using System.Net;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using NetTopologySuite.Geometries;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+using WhatApi;
+
+#nullable disable
+
+namespace WhatApi.Migrations
+{
+ [DbContext(typeof(Database))]
+ [Migration("20251013213511_Initial")]
+ partial class Initial
+ {
+ /// <inheritdoc />
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "9.0.9")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis");
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("WhatApi.Tables.Content", b =>
+ {
+ b.Property<Guid>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property<Guid>("BlobId")
+ .HasColumnType("uuid");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property<IPAddress>("Ip")
+ .IsRequired()
+ .HasColumnType("inet");
+
+ b.Property<string>("Mime")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("Content");
+ });
+
+ modelBuilder.Entity("WhatApi.Tables.Place", b =>
+ {
+ b.Property<Guid>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property<Guid>("ContentId")
+ .HasColumnType("uuid");
+
+ b.Property<Point>("Location")
+ .IsRequired()
+ .HasColumnType("geometry(point,4326)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ContentId");
+
+ b.HasIndex("Location");
+
+ NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("Location"), "gist");
+
+ b.ToTable("Place", (string)null);
+ });
+
+ modelBuilder.Entity("WhatApi.Tables.Place", b =>
+ {
+ b.HasOne("WhatApi.Tables.Content", "Content")
+ .WithMany()
+ .HasForeignKey("ContentId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Content");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/api/WhatApi/Migrations/20251013213511_Initial.cs b/api/WhatApi/Migrations/20251013213511_Initial.cs
new file mode 100644
index 0000000..1fa8bbf
--- /dev/null
+++ b/api/WhatApi/Migrations/20251013213511_Initial.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Net;
+using Microsoft.EntityFrameworkCore.Migrations;
+using NetTopologySuite.Geometries;
+
+#nullable disable
+
+namespace WhatApi.Migrations
+{
+ /// <inheritdoc />
+ public partial class Initial : Migration
+ {
+ /// <inheritdoc />
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AlterDatabase()
+ .Annotation("Npgsql:PostgresExtension:postgis", ",,");
+
+ migrationBuilder.CreateTable(
+ name: "Content",
+ columns: table => new
+ {
+ Id = table.Column<Guid>(type: "uuid", nullable: false),
+ Mime = table.Column<string>(type: "text", nullable: false),
+ Created = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
+ BlobId = table.Column<Guid>(type: "uuid", nullable: false),
+ Ip = table.Column<IPAddress>(type: "inet", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Content", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Place",
+ columns: table => new
+ {
+ Id = table.Column<Guid>(type: "uuid", nullable: false),
+ ContentId = table.Column<Guid>(type: "uuid", nullable: false),
+ Location = table.Column<Point>(type: "geometry(point,4326)", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Place", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Place_Content_ContentId",
+ column: x => x.ContentId,
+ principalTable: "Content",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Place_ContentId",
+ table: "Place",
+ column: "ContentId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Place_Location",
+ table: "Place",
+ column: "Location")
+ .Annotation("Npgsql:IndexMethod", "gist");
+ }
+
+ /// <inheritdoc />
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "Place");
+
+ migrationBuilder.DropTable(
+ name: "Content");
+ }
+ }
+}
diff --git a/api/WhatApi/Migrations/DatabaseModelSnapshot.cs b/api/WhatApi/Migrations/DatabaseModelSnapshot.cs
new file mode 100644
index 0000000..f1e5fcb
--- /dev/null
+++ b/api/WhatApi/Migrations/DatabaseModelSnapshot.cs
@@ -0,0 +1,90 @@
+// <auto-generated />
+using System;
+using System.Net;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using NetTopologySuite.Geometries;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+using WhatApi;
+
+#nullable disable
+
+namespace WhatApi.Migrations
+{
+ [DbContext(typeof(Database))]
+ partial class DatabaseModelSnapshot : ModelSnapshot
+ {
+ protected override void BuildModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "9.0.9")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis");
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("WhatApi.Tables.Content", b =>
+ {
+ b.Property<Guid>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property<Guid>("BlobId")
+ .HasColumnType("uuid");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property<IPAddress>("Ip")
+ .IsRequired()
+ .HasColumnType("inet");
+
+ b.Property<string>("Mime")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("Content");
+ });
+
+ modelBuilder.Entity("WhatApi.Tables.Place", b =>
+ {
+ b.Property<Guid>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property<Guid>("ContentId")
+ .HasColumnType("uuid");
+
+ b.Property<Point>("Location")
+ .IsRequired()
+ .HasColumnType("geometry(point,4326)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ContentId");
+
+ b.HasIndex("Location");
+
+ NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("Location"), "gist");
+
+ b.ToTable("Place", (string)null);
+ });
+
+ modelBuilder.Entity("WhatApi.Tables.Place", b =>
+ {
+ b.HasOne("WhatApi.Tables.Content", "Content")
+ .WithMany()
+ .HasForeignKey("ContentId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Content");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}