summaryrefslogtreecommitdiffstats
path: root/api/WhatApi/Migrations/DatabaseModelSnapshot.cs
diff options
context:
space:
mode:
authorivar <i@oiee.no>2025-10-26 22:57:28 +0100
committerivar <i@oiee.no>2025-10-26 22:57:28 +0100
commit842502e82c4ddfea05a5f77c361aaa27f75afc42 (patch)
tree70fe96cd88600224257b80569015008626e3d317 /api/WhatApi/Migrations/DatabaseModelSnapshot.cs
parent5c59225ee10949cc58fccce4d968d1ede58be9b6 (diff)
downloadwhat-842502e82c4ddfea05a5f77c361aaa27f75afc42.tar.xz
what-842502e82c4ddfea05a5f77c361aaa27f75afc42.zip
Refactor db schema and add audits
Diffstat (limited to 'api/WhatApi/Migrations/DatabaseModelSnapshot.cs')
-rw-r--r--api/WhatApi/Migrations/DatabaseModelSnapshot.cs129
1 files changed, 125 insertions, 4 deletions
diff --git a/api/WhatApi/Migrations/DatabaseModelSnapshot.cs b/api/WhatApi/Migrations/DatabaseModelSnapshot.cs
index f1e5fcb..1d81e04 100644
--- a/api/WhatApi/Migrations/DatabaseModelSnapshot.cs
+++ b/api/WhatApi/Migrations/DatabaseModelSnapshot.cs
@@ -1,5 +1,6 @@
// <auto-generated />
using System;
+using System.Collections.Generic;
using System.Net;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
@@ -25,6 +26,50 @@ namespace WhatApi.Migrations
NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis");
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+ modelBuilder.Entity("WhatApi.Tables.AuditTrail", b =>
+ {
+ b.Property<Guid>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.PrimitiveCollection<List<string>>("ChangedColumns")
+ .IsRequired()
+ .HasColumnType("jsonb");
+
+ b.Property<DateTimeOffset>("DateUtc")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property<string>("EntityName")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("character varying(100)");
+
+ b.Property<Dictionary<string, object>>("NewValues")
+ .IsRequired()
+ .HasColumnType("jsonb");
+
+ b.Property<Dictionary<string, object>>("OldValues")
+ .IsRequired()
+ .HasColumnType("jsonb");
+
+ b.Property<string>("PrimaryKey")
+ .HasMaxLength(100)
+ .HasColumnType("character varying(100)");
+
+ b.Property<string>("TrailType")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property<Guid?>("UserId")
+ .HasColumnType("uuid");
+
+ b.HasKey("Id");
+
+ b.HasIndex("EntityName");
+
+ b.ToTable("audit_trails", (string)null);
+ });
+
modelBuilder.Entity("WhatApi.Tables.Content", b =>
{
b.Property<Guid>("Id")
@@ -34,20 +79,30 @@ namespace WhatApi.Migrations
b.Property<Guid>("BlobId")
.HasColumnType("uuid");
- b.Property<DateTime>("Created")
+ b.Property<DateTimeOffset>("CreatedAtUtc")
.HasColumnType("timestamp with time zone");
+ b.Property<Guid>("CreatedBy")
+ .HasColumnType("uuid");
+
b.Property<IPAddress>("Ip")
.IsRequired()
.HasColumnType("inet");
b.Property<string>("Mime")
.IsRequired()
- .HasColumnType("text");
+ .HasMaxLength(100)
+ .HasColumnType("character varying(100)");
+
+ b.Property<DateTimeOffset?>("UpdatedAtUtc")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property<Guid?>("UpdatedBy")
+ .HasColumnType("uuid");
b.HasKey("Id");
- b.ToTable("Content");
+ b.ToTable("content", (string)null);
});
modelBuilder.Entity("WhatApi.Tables.Place", b =>
@@ -59,10 +114,25 @@ namespace WhatApi.Migrations
b.Property<Guid>("ContentId")
.HasColumnType("uuid");
+ b.Property<DateTimeOffset>("CreatedAtUtc")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property<Guid>("CreatedBy")
+ .HasColumnType("uuid");
+
b.Property<Point>("Location")
.IsRequired()
.HasColumnType("geometry(point,4326)");
+ b.Property<DateTimeOffset?>("UpdatedAtUtc")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property<Guid?>("UpdatedBy")
+ .HasColumnType("uuid");
+
+ b.Property<Guid?>("UserId")
+ .HasColumnType("uuid");
+
b.HasKey("Id");
b.HasIndex("ContentId");
@@ -71,7 +141,49 @@ namespace WhatApi.Migrations
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("Location"), "gist");
- b.ToTable("Place", (string)null);
+ b.HasIndex("UserId");
+
+ b.ToTable("place", (string)null);
+ });
+
+ modelBuilder.Entity("WhatApi.Tables.User", b =>
+ {
+ b.Property<Guid>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property<DateTimeOffset>("CreatedAtUtc")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property<Guid>("CreatedBy")
+ .HasColumnType("uuid");
+
+ b.Property<string>("Email")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("character varying(100)");
+
+ b.Property<DateTimeOffset?>("LastSeen")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property<string>("Name")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("character varying(50)");
+
+ b.Property<string>("Password")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property<DateTimeOffset?>("UpdatedAtUtc")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property<Guid?>("UpdatedBy")
+ .HasColumnType("uuid");
+
+ b.HasKey("Id");
+
+ b.ToTable("user", (string)null);
});
modelBuilder.Entity("WhatApi.Tables.Place", b =>
@@ -82,8 +194,17 @@ namespace WhatApi.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
+ b.HasOne("WhatApi.Tables.User", null)
+ .WithMany("Places")
+ .HasForeignKey("UserId");
+
b.Navigation("Content");
});
+
+ modelBuilder.Entity("WhatApi.Tables.User", b =>
+ {
+ b.Navigation("Places");
+ });
#pragma warning restore 612, 618
}
}