diff options
Diffstat (limited to 'api/WhatApi/Migrations')
3 files changed, 255 insertions, 3 deletions
diff --git a/api/WhatApi/Migrations/20251202203059_PasswordMaxLength.Designer.cs b/api/WhatApi/Migrations/20251202203059_PasswordMaxLength.Designer.cs new file mode 100644 index 0000000..f23a067 --- /dev/null +++ b/api/WhatApi/Migrations/20251202203059_PasswordMaxLength.Designer.cs @@ -0,0 +1,215 @@ +// <auto-generated /> +using System; +using System.Collections.Generic; +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("20251202203059_PasswordMaxLength")] + partial class PasswordMaxLength + { + /// <inheritdoc /> + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "10.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("WhatApi.Tables.AuditTrail", b => + { + b.Property<Guid>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.PrimitiveCollection<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") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property<Guid>("BlobId") + .HasColumnType("uuid"); + + 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() + .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", (string)null); + }); + + modelBuilder.Entity("WhatApi.Tables.Place", b => + { + b.Property<Guid>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + 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"); + + b.HasIndex("Location"); + + NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("Location"), "gist"); + + 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() + .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("user", (string)null); + }); + + modelBuilder.Entity("WhatApi.Tables.Place", b => + { + b.HasOne("WhatApi.Tables.Content", "Content") + .WithMany() + .HasForeignKey("ContentId") + .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 + } + } +} diff --git a/api/WhatApi/Migrations/20251202203059_PasswordMaxLength.cs b/api/WhatApi/Migrations/20251202203059_PasswordMaxLength.cs new file mode 100644 index 0000000..8129df8 --- /dev/null +++ b/api/WhatApi/Migrations/20251202203059_PasswordMaxLength.cs @@ -0,0 +1,36 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace WhatApi.Migrations +{ + /// <inheritdoc /> + public partial class PasswordMaxLength : Migration + { + /// <inheritdoc /> + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn<string>( + name: "Password", + table: "user", + type: "character varying(100)", + maxLength: 100, + nullable: false, + oldClrType: typeof(string), + oldType: "text"); + } + + /// <inheritdoc /> + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn<string>( + name: "Password", + table: "user", + type: "text", + nullable: false, + oldClrType: typeof(string), + oldType: "character varying(100)", + oldMaxLength: 100); + } + } +} diff --git a/api/WhatApi/Migrations/DatabaseModelSnapshot.cs b/api/WhatApi/Migrations/DatabaseModelSnapshot.cs index 1d81e04..babdf01 100644 --- a/api/WhatApi/Migrations/DatabaseModelSnapshot.cs +++ b/api/WhatApi/Migrations/DatabaseModelSnapshot.cs @@ -20,7 +20,7 @@ namespace WhatApi.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "9.0.9") + .HasAnnotation("ProductVersion", "10.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); @@ -32,7 +32,7 @@ namespace WhatApi.Migrations .ValueGeneratedOnAdd() .HasColumnType("uuid"); - b.PrimitiveCollection<List<string>>("ChangedColumns") + b.PrimitiveCollection<string>("ChangedColumns") .IsRequired() .HasColumnType("jsonb"); @@ -173,7 +173,8 @@ namespace WhatApi.Migrations b.Property<string>("Password") .IsRequired() - .HasColumnType("text"); + .HasMaxLength(100) + .HasColumnType("character varying(100)"); b.Property<DateTimeOffset?>("UpdatedAtUtc") .HasColumnType("timestamp with time zone"); |
