diff --git a/src/Data/Migrations/20240904021127_AddMaxLengths.Designer.cs b/src/Data/Migrations/20240904021127_AddMaxLengths.Designer.cs new file mode 100644 index 0000000..c6f5dce --- /dev/null +++ b/src/Data/Migrations/20240904021127_AddMaxLengths.Designer.cs @@ -0,0 +1,55 @@ +// +using Fergun.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Fergun.Data.Migrations +{ + [DbContext(typeof(FergunContext))] + [Migration("20240904021127_AddMaxLengths")] + partial class AddMaxLengths + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "8.0.7"); + + modelBuilder.Entity("Fergun.Data.Models.Command", b => + { + b.Property("Name") + .HasMaxLength(32) + .HasColumnType("TEXT"); + + b.Property("UsageCount") + .HasColumnType("INTEGER"); + + b.HasKey("Name"); + + b.ToTable("CommandStats"); + }); + + modelBuilder.Entity("Fergun.Data.Models.User", b => + { + b.Property("Id") + .HasColumnType("INTEGER"); + + b.Property("BlacklistReason") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("BlacklistStatus") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("Users"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Data/Migrations/20240904021127_AddMaxLengths.cs b/src/Data/Migrations/20240904021127_AddMaxLengths.cs new file mode 100644 index 0000000..b46fa19 --- /dev/null +++ b/src/Data/Migrations/20240904021127_AddMaxLengths.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Fergun.Data.Migrations +{ + /// + public partial class AddMaxLengths : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/src/Data/Migrations/FergunContextModelSnapshot.cs b/src/Data/Migrations/FergunContextModelSnapshot.cs index afdf6e7..2bd8ff5 100644 --- a/src/Data/Migrations/FergunContextModelSnapshot.cs +++ b/src/Data/Migrations/FergunContextModelSnapshot.cs @@ -14,11 +14,12 @@ partial class FergunContextModelSnapshot : ModelSnapshot protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "6.0.4"); + modelBuilder.HasAnnotation("ProductVersion", "8.0.7"); modelBuilder.Entity("Fergun.Data.Models.Command", b => { b.Property("Name") + .HasMaxLength(32) .HasColumnType("TEXT"); b.Property("UsageCount") @@ -35,6 +36,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("INTEGER"); b.Property("BlacklistReason") + .HasMaxLength(256) .HasColumnType("TEXT"); b.Property("BlacklistStatus") diff --git a/src/Data/Models/Command.cs b/src/Data/Models/Command.cs index b5cea39..bfd8d55 100644 --- a/src/Data/Models/Command.cs +++ b/src/Data/Models/Command.cs @@ -11,11 +11,11 @@ public class Command /// Gets or sets the name of this command. /// [Key] + [MaxLength(32)] public string Name { get; set; } = null!; /// /// Gets or sets the usage count. /// - [Required] public int UsageCount { get; set; } } \ No newline at end of file diff --git a/src/Data/Models/User.cs b/src/Data/Models/User.cs index 7507515..1edf933 100644 --- a/src/Data/Models/User.cs +++ b/src/Data/Models/User.cs @@ -17,11 +17,11 @@ public class User : IEntity /// /// Gets or sets the blacklist status. /// - [Required] public BlacklistStatus BlacklistStatus { get; set; } /// /// Gets or sets the blacklist reason. /// + [MaxLength(256)] public string? BlacklistReason { get; set; } } \ No newline at end of file