From dffa2152d9680bab9b0992d6780ba2d496a18ee2 Mon Sep 17 00:00:00 2001 From: Jonathan Bourdon Date: Wed, 2 Apr 2025 23:58:52 -0400 Subject: [PATCH] Changed Urls in DB to be 2048 chars long --- .../src/Web/Features/Contents/Data/Content.cs | 4 +- .../src/Web/Features/Contents/Data/Creator.cs | 34 +- ...20250403035555_UrlsTo2048Chars.Designer.cs | 376 ++++++++++++++ .../20250403035555_UrlsTo2048Chars.cs | 460 ++++++++++++++++++ .../ContentDbContextModelSnapshot.cs | 76 +-- ...20250403035646_UrlsTo2048Chars.Designer.cs | 308 ++++++++++++ .../20250403035646_UrlsTo2048Chars.cs | 42 ++ .../ApplicationDbContextModelSnapshot.cs | 4 +- .../src/Web/Features/Users/IdentityUser.cs | 2 +- 9 files changed, 1246 insertions(+), 60 deletions(-) create mode 100644 backend/src/Web/Features/Contents/Data/Migrations/20250403035555_UrlsTo2048Chars.Designer.cs create mode 100644 backend/src/Web/Features/Contents/Data/Migrations/20250403035555_UrlsTo2048Chars.cs create mode 100644 backend/src/Web/Features/Users/Data/Migrations/20250403035646_UrlsTo2048Chars.Designer.cs create mode 100644 backend/src/Web/Features/Users/Data/Migrations/20250403035646_UrlsTo2048Chars.cs diff --git a/backend/src/Web/Features/Contents/Data/Content.cs b/backend/src/Web/Features/Contents/Data/Content.cs index f6e08fc..5a2be9c 100644 --- a/backend/src/Web/Features/Contents/Data/Content.cs +++ b/backend/src/Web/Features/Contents/Data/Content.cs @@ -12,9 +12,9 @@ public class Content public DateTimeOffset? DeletedAt { get; set; } [MaxLength(128)] public required string Title { get; set; } - [MaxLength(1024)] public string? ThumbnailUrl { get; set; } = ""; + [MaxLength(2048)] public string? ThumbnailUrl { get; set; } = ""; [MaxLength(2048)] public string Description { get; set; } = ""; - [MaxLength(1024)] public string? HtmlFileUrl { get; set; } = ""; + [MaxLength(2048)] public string? HtmlFileUrl { get; set; } = ""; public IList Reactions { get; set; } = new List(); public string[]? Urls { get; init; } diff --git a/backend/src/Web/Features/Contents/Data/Creator.cs b/backend/src/Web/Features/Contents/Data/Creator.cs index 4fa83e4..a33b7ec 100644 --- a/backend/src/Web/Features/Contents/Data/Creator.cs +++ b/backend/src/Web/Features/Contents/Data/Creator.cs @@ -18,20 +18,20 @@ public class Creator public class Socials { - [MaxLength(1024)] public string? FacebookUrl { get; set; } - [MaxLength(1024)] public string? InstagramUrl { get; set; } - [MaxLength(1024)] public string? XUrl { get; set; } - [MaxLength(1024)] public string? LinkedInUrl { get; set; } - [MaxLength(1024)] public string? TikTokUrl { get; set; } - [MaxLength(1024)] public string? YoutubeUrl { get; set; } - [MaxLength(1024)] public string? RedditUrl { get; set; } - [MaxLength(1024)] public string? WebsiteUrl { get; set; } + [MaxLength(2048)] public string? FacebookUrl { get; set; } + [MaxLength(2048)] public string? InstagramUrl { get; set; } + [MaxLength(2048)] public string? XUrl { get; set; } + [MaxLength(2048)] public string? LinkedInUrl { get; set; } + [MaxLength(2048)] public string? TikTokUrl { get; set; } + [MaxLength(2048)] public string? YoutubeUrl { get; set; } + [MaxLength(2048)] public string? RedditUrl { get; set; } + [MaxLength(2048)] public string? WebsiteUrl { get; set; } } public class Images { - [MaxLength(255)] public string? Banner { get; set; } - [MaxLength(255)] public string? Logo { get; set; } + [MaxLength(2048)] public string? Banner { get; set; } + [MaxLength(2048)] public string? Logo { get; set; } } public class PresentationInfos @@ -39,18 +39,18 @@ public class PresentationInfos [MaxLength(255)] public string PhoneNumber { get; set; } = string.Empty; [MaxLength(255)] public string Email { get; set; } = string.Empty; [MaxLength(2000)] public string Title { get; set; } = string.Empty; - [MaxLength(1024)] public string MainImageUrl { get; set; } = string.Empty; + [MaxLength(2048)] public string MainImageUrl { get; set; } = string.Empty; [MaxLength(10000)] public string MainImageText { get; set; } = string.Empty; [MaxLength(10000)] public string MainVideoText { get; set; } = string.Empty; [MaxLength(2000)] public string ImagesSubtitle { get; set; } = string.Empty; - [MaxLength(1024)] public string Image1Url { get; set; } = string.Empty; - [MaxLength(1024)] public string Image2Url { get; set; } = string.Empty; - [MaxLength(1024)] public string Image3Url { get; set; } = string.Empty; - [MaxLength(1024)] public string Image4Url { get; set; } = string.Empty; + [MaxLength(2048)] public string Image1Url { get; set; } = string.Empty; + [MaxLength(2048)] public string Image2Url { get; set; } = string.Empty; + [MaxLength(2048)] public string Image3Url { get; set; } = string.Empty; + [MaxLength(2048)] public string Image4Url { get; set; } = string.Empty; [MaxLength(10000)] public string ImagesText { get; set; } = string.Empty; [MaxLength(2000)] public string VideoSubtitle { get; set; } = string.Empty; [MaxLength(2000)] public string VideoSubtitleMain { get; set; } = string.Empty; - [MaxLength(1024)] public string VideoUrlMain { get; set; } = string.Empty; - [MaxLength(1024)] public string VideoUrl { get; set; } = string.Empty; + [MaxLength(2048)] public string VideoUrlMain { get; set; } = string.Empty; + [MaxLength(2048)] public string VideoUrl { get; set; } = string.Empty; [MaxLength(10000)] public string VideoText { get; set; } = string.Empty; } diff --git a/backend/src/Web/Features/Contents/Data/Migrations/20250403035555_UrlsTo2048Chars.Designer.cs b/backend/src/Web/Features/Contents/Data/Migrations/20250403035555_UrlsTo2048Chars.Designer.cs new file mode 100644 index 0000000..3293357 --- /dev/null +++ b/backend/src/Web/Features/Contents/Data/Migrations/20250403035555_UrlsTo2048Chars.Designer.cs @@ -0,0 +1,376 @@ +// +using System; +using Hutopy.Web.Features.Contents.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Hutopy.Web.Features.Contents.Data.Migrations +{ + [DbContext(typeof(ContentDbContext))] + [Migration("20250403035555_UrlsTo2048Chars")] + partial class UrlsTo2048Chars + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Content") + .HasAnnotation("ProductVersion", "9.0.3") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Content", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("CreatedBy") + .HasColumnType("uuid"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("DeletedBy") + .HasColumnType("uuid"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("HtmlFileUrl") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("ThumbnailUrl") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.PrimitiveCollection("Urls") + .HasColumnType("text[]"); + + b.HasKey("Id"); + + b.HasIndex("CreatedBy"); + + b.ToTable("Contents", "Content"); + }); + + modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Creator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AcceptDonation") + .HasColumnType("boolean"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("CreatedBy") + .HasColumnType("uuid"); + + b.Property("SlugsId") + .HasColumnType("uuid"); + + b.Property("Title") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Verified") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("SlugsId"); + + b.ToTable("Creators", "Content"); + }); + + modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Slugs", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Active") + .HasColumnType("boolean"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("CreatedBy") + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("NormalizedName") + .IsRequired() + .ValueGeneratedOnAddOrUpdate() + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasComputedColumnSql("LOWER( \"Content\".\"Slugs\".\"Name\")", true); + + b.Property("ReservedUntil") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique(); + + b.ToTable("Slugs", "Content"); + }); + + modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Content", b => + { + b.HasOne("Hutopy.Web.Features.Contents.Data.Creator", "Creator") + .WithMany() + .HasForeignKey("CreatedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsMany("Hutopy.Web.Features.Contents.Data.ContentReaction", "Reactions", b1 => + { + b1.Property("ContentId") + .HasColumnType("uuid"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b1.Property("Id")); + + b1.Property("Reaction") + .HasColumnType("integer"); + + b1.Property("UserId") + .HasColumnType("uuid"); + + b1.Property("UserName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b1.HasKey("ContentId", "Id"); + + b1.ToTable("Reactions", "Content"); + + b1.WithOwner() + .HasForeignKey("ContentId"); + }); + + b.Navigation("Creator"); + + b.Navigation("Reactions"); + }); + + modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Creator", b => + { + b.HasOne("Hutopy.Web.Features.Contents.Data.Slugs", "Slugs") + .WithMany() + .HasForeignKey("SlugsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsOne("Hutopy.Web.Features.Contents.Data.Images", "Images", b1 => + { + b1.Property("CreatorId") + .HasColumnType("uuid"); + + b1.Property("Banner") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b1.Property("Logo") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b1.HasKey("CreatorId"); + + b1.ToTable("Images", "Content"); + + b1.WithOwner() + .HasForeignKey("CreatorId"); + }); + + b.OwnsOne("Hutopy.Web.Features.Contents.Data.PresentationInfos", "PresentationInfos", b1 => + { + b1.Property("CreatorId") + .HasColumnType("uuid"); + + b1.Property("Email") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b1.Property("Image1Url") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b1.Property("Image2Url") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b1.Property("Image3Url") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b1.Property("Image4Url") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b1.Property("ImagesSubtitle") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b1.Property("ImagesText") + .IsRequired() + .HasMaxLength(10000) + .HasColumnType("character varying(10000)"); + + b1.Property("MainImageText") + .IsRequired() + .HasMaxLength(10000) + .HasColumnType("character varying(10000)"); + + b1.Property("MainImageUrl") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b1.Property("MainVideoText") + .IsRequired() + .HasMaxLength(10000) + .HasColumnType("character varying(10000)"); + + b1.Property("PhoneNumber") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b1.Property("Title") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b1.Property("VideoSubtitle") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b1.Property("VideoSubtitleMain") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b1.Property("VideoText") + .IsRequired() + .HasMaxLength(10000) + .HasColumnType("character varying(10000)"); + + b1.Property("VideoUrl") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b1.Property("VideoUrlMain") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b1.HasKey("CreatorId"); + + b1.ToTable("PresentationInfos", "Content"); + + b1.WithOwner() + .HasForeignKey("CreatorId"); + }); + + b.OwnsOne("Hutopy.Web.Features.Contents.Data.Socials", "Socials", b1 => + { + b1.Property("CreatorId") + .HasColumnType("uuid"); + + b1.Property("FacebookUrl") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b1.Property("InstagramUrl") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b1.Property("LinkedInUrl") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b1.Property("RedditUrl") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b1.Property("TikTokUrl") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b1.Property("WebsiteUrl") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b1.Property("XUrl") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b1.Property("YoutubeUrl") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b1.HasKey("CreatorId"); + + b1.ToTable("Socials", "Content"); + + b1.WithOwner() + .HasForeignKey("CreatorId"); + }); + + b.Navigation("Images") + .IsRequired(); + + b.Navigation("PresentationInfos") + .IsRequired(); + + b.Navigation("Slugs"); + + b.Navigation("Socials") + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/backend/src/Web/Features/Contents/Data/Migrations/20250403035555_UrlsTo2048Chars.cs b/backend/src/Web/Features/Contents/Data/Migrations/20250403035555_UrlsTo2048Chars.cs new file mode 100644 index 0000000..09e2785 --- /dev/null +++ b/backend/src/Web/Features/Contents/Data/Migrations/20250403035555_UrlsTo2048Chars.cs @@ -0,0 +1,460 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Hutopy.Web.Features.Contents.Data.Migrations +{ + /// + public partial class UrlsTo2048Chars : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "YoutubeUrl", + schema: "Content", + table: "Socials", + type: "character varying(2048)", + maxLength: 2048, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(1024)", + oldMaxLength: 1024, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "XUrl", + schema: "Content", + table: "Socials", + type: "character varying(2048)", + maxLength: 2048, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(1024)", + oldMaxLength: 1024, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "WebsiteUrl", + schema: "Content", + table: "Socials", + type: "character varying(2048)", + maxLength: 2048, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(1024)", + oldMaxLength: 1024, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "TikTokUrl", + schema: "Content", + table: "Socials", + type: "character varying(2048)", + maxLength: 2048, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(1024)", + oldMaxLength: 1024, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RedditUrl", + schema: "Content", + table: "Socials", + type: "character varying(2048)", + maxLength: 2048, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(1024)", + oldMaxLength: 1024, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "LinkedInUrl", + schema: "Content", + table: "Socials", + type: "character varying(2048)", + maxLength: 2048, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(1024)", + oldMaxLength: 1024, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "InstagramUrl", + schema: "Content", + table: "Socials", + type: "character varying(2048)", + maxLength: 2048, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(1024)", + oldMaxLength: 1024, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "FacebookUrl", + schema: "Content", + table: "Socials", + type: "character varying(2048)", + maxLength: 2048, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(1024)", + oldMaxLength: 1024, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "VideoUrlMain", + schema: "Content", + table: "PresentationInfos", + type: "character varying(2048)", + maxLength: 2048, + nullable: false, + oldClrType: typeof(string), + oldType: "character varying(1024)", + oldMaxLength: 1024); + + migrationBuilder.AlterColumn( + name: "VideoUrl", + schema: "Content", + table: "PresentationInfos", + type: "character varying(2048)", + maxLength: 2048, + nullable: false, + oldClrType: typeof(string), + oldType: "character varying(1024)", + oldMaxLength: 1024); + + migrationBuilder.AlterColumn( + name: "MainImageUrl", + schema: "Content", + table: "PresentationInfos", + type: "character varying(2048)", + maxLength: 2048, + nullable: false, + oldClrType: typeof(string), + oldType: "character varying(1024)", + oldMaxLength: 1024); + + migrationBuilder.AlterColumn( + name: "Image4Url", + schema: "Content", + table: "PresentationInfos", + type: "character varying(2048)", + maxLength: 2048, + nullable: false, + oldClrType: typeof(string), + oldType: "character varying(1024)", + oldMaxLength: 1024); + + migrationBuilder.AlterColumn( + name: "Image3Url", + schema: "Content", + table: "PresentationInfos", + type: "character varying(2048)", + maxLength: 2048, + nullable: false, + oldClrType: typeof(string), + oldType: "character varying(1024)", + oldMaxLength: 1024); + + migrationBuilder.AlterColumn( + name: "Image2Url", + schema: "Content", + table: "PresentationInfos", + type: "character varying(2048)", + maxLength: 2048, + nullable: false, + oldClrType: typeof(string), + oldType: "character varying(1024)", + oldMaxLength: 1024); + + migrationBuilder.AlterColumn( + name: "Image1Url", + schema: "Content", + table: "PresentationInfos", + type: "character varying(2048)", + maxLength: 2048, + nullable: false, + oldClrType: typeof(string), + oldType: "character varying(1024)", + oldMaxLength: 1024); + + migrationBuilder.AlterColumn( + name: "Logo", + schema: "Content", + table: "Images", + type: "character varying(2048)", + maxLength: 2048, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(255)", + oldMaxLength: 255, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Banner", + schema: "Content", + table: "Images", + type: "character varying(2048)", + maxLength: 2048, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(255)", + oldMaxLength: 255, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ThumbnailUrl", + schema: "Content", + table: "Contents", + type: "character varying(2048)", + maxLength: 2048, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(1024)", + oldMaxLength: 1024, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "HtmlFileUrl", + schema: "Content", + table: "Contents", + type: "character varying(2048)", + maxLength: 2048, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(1024)", + oldMaxLength: 1024, + oldNullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "YoutubeUrl", + schema: "Content", + table: "Socials", + type: "character varying(1024)", + maxLength: 1024, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(2048)", + oldMaxLength: 2048, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "XUrl", + schema: "Content", + table: "Socials", + type: "character varying(1024)", + maxLength: 1024, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(2048)", + oldMaxLength: 2048, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "WebsiteUrl", + schema: "Content", + table: "Socials", + type: "character varying(1024)", + maxLength: 1024, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(2048)", + oldMaxLength: 2048, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "TikTokUrl", + schema: "Content", + table: "Socials", + type: "character varying(1024)", + maxLength: 1024, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(2048)", + oldMaxLength: 2048, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RedditUrl", + schema: "Content", + table: "Socials", + type: "character varying(1024)", + maxLength: 1024, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(2048)", + oldMaxLength: 2048, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "LinkedInUrl", + schema: "Content", + table: "Socials", + type: "character varying(1024)", + maxLength: 1024, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(2048)", + oldMaxLength: 2048, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "InstagramUrl", + schema: "Content", + table: "Socials", + type: "character varying(1024)", + maxLength: 1024, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(2048)", + oldMaxLength: 2048, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "FacebookUrl", + schema: "Content", + table: "Socials", + type: "character varying(1024)", + maxLength: 1024, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(2048)", + oldMaxLength: 2048, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "VideoUrlMain", + schema: "Content", + table: "PresentationInfos", + type: "character varying(1024)", + maxLength: 1024, + nullable: false, + oldClrType: typeof(string), + oldType: "character varying(2048)", + oldMaxLength: 2048); + + migrationBuilder.AlterColumn( + name: "VideoUrl", + schema: "Content", + table: "PresentationInfos", + type: "character varying(1024)", + maxLength: 1024, + nullable: false, + oldClrType: typeof(string), + oldType: "character varying(2048)", + oldMaxLength: 2048); + + migrationBuilder.AlterColumn( + name: "MainImageUrl", + schema: "Content", + table: "PresentationInfos", + type: "character varying(1024)", + maxLength: 1024, + nullable: false, + oldClrType: typeof(string), + oldType: "character varying(2048)", + oldMaxLength: 2048); + + migrationBuilder.AlterColumn( + name: "Image4Url", + schema: "Content", + table: "PresentationInfos", + type: "character varying(1024)", + maxLength: 1024, + nullable: false, + oldClrType: typeof(string), + oldType: "character varying(2048)", + oldMaxLength: 2048); + + migrationBuilder.AlterColumn( + name: "Image3Url", + schema: "Content", + table: "PresentationInfos", + type: "character varying(1024)", + maxLength: 1024, + nullable: false, + oldClrType: typeof(string), + oldType: "character varying(2048)", + oldMaxLength: 2048); + + migrationBuilder.AlterColumn( + name: "Image2Url", + schema: "Content", + table: "PresentationInfos", + type: "character varying(1024)", + maxLength: 1024, + nullable: false, + oldClrType: typeof(string), + oldType: "character varying(2048)", + oldMaxLength: 2048); + + migrationBuilder.AlterColumn( + name: "Image1Url", + schema: "Content", + table: "PresentationInfos", + type: "character varying(1024)", + maxLength: 1024, + nullable: false, + oldClrType: typeof(string), + oldType: "character varying(2048)", + oldMaxLength: 2048); + + migrationBuilder.AlterColumn( + name: "Logo", + schema: "Content", + table: "Images", + type: "character varying(255)", + maxLength: 255, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(2048)", + oldMaxLength: 2048, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Banner", + schema: "Content", + table: "Images", + type: "character varying(255)", + maxLength: 255, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(2048)", + oldMaxLength: 2048, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ThumbnailUrl", + schema: "Content", + table: "Contents", + type: "character varying(1024)", + maxLength: 1024, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(2048)", + oldMaxLength: 2048, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "HtmlFileUrl", + schema: "Content", + table: "Contents", + type: "character varying(1024)", + maxLength: 1024, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(2048)", + oldMaxLength: 2048, + oldNullable: true); + } + } +} diff --git a/backend/src/Web/Features/Contents/Data/Migrations/ContentDbContextModelSnapshot.cs b/backend/src/Web/Features/Contents/Data/Migrations/ContentDbContextModelSnapshot.cs index 49d73a7..3152c58 100644 --- a/backend/src/Web/Features/Contents/Data/Migrations/ContentDbContextModelSnapshot.cs +++ b/backend/src/Web/Features/Contents/Data/Migrations/ContentDbContextModelSnapshot.cs @@ -49,12 +49,12 @@ namespace Hutopy.Web.Features.Contents.Data.Migrations .HasColumnType("character varying(2048)"); b.Property("HtmlFileUrl") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)"); + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); b.Property("ThumbnailUrl") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)"); + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); b.Property("Title") .IsRequired() @@ -198,12 +198,12 @@ namespace Hutopy.Web.Features.Contents.Data.Migrations .HasColumnType("uuid"); b1.Property("Banner") - .HasMaxLength(255) - .HasColumnType("character varying(255)"); + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); b1.Property("Logo") - .HasMaxLength(255) - .HasColumnType("character varying(255)"); + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); b1.HasKey("CreatorId"); @@ -225,23 +225,23 @@ namespace Hutopy.Web.Features.Contents.Data.Migrations b1.Property("Image1Url") .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)"); + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); b1.Property("Image2Url") .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)"); + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); b1.Property("Image3Url") .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)"); + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); b1.Property("Image4Url") .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)"); + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); b1.Property("ImagesSubtitle") .IsRequired() @@ -260,8 +260,8 @@ namespace Hutopy.Web.Features.Contents.Data.Migrations b1.Property("MainImageUrl") .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)"); + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); b1.Property("MainVideoText") .IsRequired() @@ -295,13 +295,13 @@ namespace Hutopy.Web.Features.Contents.Data.Migrations b1.Property("VideoUrl") .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)"); + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); b1.Property("VideoUrlMain") .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)"); + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); b1.HasKey("CreatorId"); @@ -317,36 +317,36 @@ namespace Hutopy.Web.Features.Contents.Data.Migrations .HasColumnType("uuid"); b1.Property("FacebookUrl") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)"); + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); b1.Property("InstagramUrl") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)"); + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); b1.Property("LinkedInUrl") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)"); + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); b1.Property("RedditUrl") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)"); + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); b1.Property("TikTokUrl") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)"); + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); b1.Property("WebsiteUrl") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)"); + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); b1.Property("XUrl") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)"); + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); b1.Property("YoutubeUrl") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)"); + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); b1.HasKey("CreatorId"); diff --git a/backend/src/Web/Features/Users/Data/Migrations/20250403035646_UrlsTo2048Chars.Designer.cs b/backend/src/Web/Features/Users/Data/Migrations/20250403035646_UrlsTo2048Chars.Designer.cs new file mode 100644 index 0000000..cf019b7 --- /dev/null +++ b/backend/src/Web/Features/Users/Data/Migrations/20250403035646_UrlsTo2048Chars.Designer.cs @@ -0,0 +1,308 @@ +// +using System; +using Hutopy.Web.Features.Users.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Hutopy.Web.Features.Users.Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20250403035646_UrlsTo2048Chars")] + partial class UrlsTo2048Chars + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Identity") + .HasAnnotation("ProductVersion", "9.0.3") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Hutopy.Web.Features.Users.IdentityRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", "Identity"); + }); + + modelBuilder.Entity("Hutopy.Web.Features.Users.IdentityUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AccessFailedCount") + .HasColumnType("integer"); + + b.Property("Address") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Alias") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("BirthDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("boolean"); + + b.Property("FacebookId") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Firstname") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("GoogleId") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Lastname") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("LockoutEnabled") + .HasColumnType("boolean"); + + b.Property("LockoutEnd") + .HasColumnType("timestamp with time zone"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PasswordHash") + .HasColumnType("text"); + + b.Property("PhoneNumber") + .HasColumnType("text"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("boolean"); + + b.Property("PortraitUrl") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("SecurityStamp") + .HasColumnType("text"); + + b.Property("TwoFactorEnabled") + .HasColumnType("boolean"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", "Identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", "Identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", "Identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("ProviderKey") + .HasColumnType("text"); + + b.Property("ProviderDisplayName") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", "Identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", "Identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", "Identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Hutopy.Web.Features.Users.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Hutopy.Web.Features.Users.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Hutopy.Web.Features.Users.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Hutopy.Web.Features.Users.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Hutopy.Web.Features.Users.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Hutopy.Web.Features.Users.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/backend/src/Web/Features/Users/Data/Migrations/20250403035646_UrlsTo2048Chars.cs b/backend/src/Web/Features/Users/Data/Migrations/20250403035646_UrlsTo2048Chars.cs new file mode 100644 index 0000000..31dfd76 --- /dev/null +++ b/backend/src/Web/Features/Users/Data/Migrations/20250403035646_UrlsTo2048Chars.cs @@ -0,0 +1,42 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Hutopy.Web.Features.Users.Data.Migrations +{ + /// + public partial class UrlsTo2048Chars : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "PortraitUrl", + schema: "Identity", + table: "AspNetUsers", + type: "character varying(2048)", + maxLength: 2048, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(1024)", + oldMaxLength: 1024, + oldNullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "PortraitUrl", + schema: "Identity", + table: "AspNetUsers", + type: "character varying(1024)", + maxLength: 1024, + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(2048)", + oldMaxLength: 2048, + oldNullable: true); + } + } +} diff --git a/backend/src/Web/Features/Users/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/backend/src/Web/Features/Users/Data/Migrations/ApplicationDbContextModelSnapshot.cs index f2bdbd1..2f23681 100644 --- a/backend/src/Web/Features/Users/Data/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/backend/src/Web/Features/Users/Data/Migrations/ApplicationDbContextModelSnapshot.cs @@ -121,8 +121,8 @@ namespace Hutopy.Web.Features.Users.Data.Migrations .HasColumnType("boolean"); b.Property("PortraitUrl") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)"); + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); b.Property("SecurityStamp") .HasColumnType("text"); diff --git a/backend/src/Web/Features/Users/IdentityUser.cs b/backend/src/Web/Features/Users/IdentityUser.cs index 78cd32e..c1d9327 100644 --- a/backend/src/Web/Features/Users/IdentityUser.cs +++ b/backend/src/Web/Features/Users/IdentityUser.cs @@ -10,7 +10,7 @@ public class IdentityUser : IdentityUser [MaxLength(255)] public string? Lastname { get; set; } public DateTime? BirthDate { get; set; } [MaxLength(255)] public string? Address { get; set; } - [MaxLength(1024)] public string? PortraitUrl { get; set; } + [MaxLength(2048)] public string? PortraitUrl { get; set; } [MaxLength(255)] public string? GoogleId { get; set; } [MaxLength(255)] public string? FacebookId { get; set; } }