Skip to content

Commit

Permalink
Add MaxLength attribute to DB entities
Browse files Browse the repository at this point in the history
  • Loading branch information
d4n3436 committed Sep 4, 2024
1 parent ee1de3f commit 6b79ec2
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 3 deletions.
55 changes: 55 additions & 0 deletions src/Data/Migrations/20240904021127_AddMaxLengths.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions src/Data/Migrations/20240904021127_AddMaxLengths.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Fergun.Data.Migrations
{
/// <inheritdoc />
public partial class AddMaxLengths : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{

}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{

}
}
}
4 changes: 3 additions & 1 deletion src/Data/Migrations/FergunContextModelSnapshot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>("Name")
.HasMaxLength(32)
.HasColumnType("TEXT");

b.Property<int>("UsageCount")
Expand All @@ -35,6 +36,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("INTEGER");

b.Property<string>("BlacklistReason")
.HasMaxLength(256)
.HasColumnType("TEXT");

b.Property<int>("BlacklistStatus")
Expand Down
2 changes: 1 addition & 1 deletion src/Data/Models/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ public class Command
/// Gets or sets the name of this command.
/// </summary>
[Key]
[MaxLength(32)]
public string Name { get; set; } = null!;

/// <summary>
/// Gets or sets the usage count.
/// </summary>
[Required]
public int UsageCount { get; set; }
}
2 changes: 1 addition & 1 deletion src/Data/Models/User.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ public class User : IEntity<ulong>
/// <summary>
/// Gets or sets the blacklist status.
/// </summary>
[Required]
public BlacklistStatus BlacklistStatus { get; set; }

/// <summary>
/// Gets or sets the blacklist reason.
/// </summary>
[MaxLength(256)]
public string? BlacklistReason { get; set; }
}

0 comments on commit 6b79ec2

Please sign in to comment.