refactor: contain backend feature mappings
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
namespace Socialize.Modules.Comments.Data;
|
||||
|
||||
public static class CommentModelConfiguration
|
||||
{
|
||||
public static ModelBuilder ConfigureCommentsModule(this ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Comment>(comment =>
|
||||
{
|
||||
comment.ToTable("Comments");
|
||||
comment.HasKey(x => x.Id);
|
||||
comment.Property(x => x.AuthorDisplayName).HasMaxLength(256).IsRequired();
|
||||
comment.Property(x => x.AuthorEmail).HasMaxLength(256).IsRequired();
|
||||
comment.Property(x => x.Body).HasMaxLength(4000).IsRequired();
|
||||
comment.Property(x => x.CreatedAt)
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
comment.HasIndex(x => x.WorkspaceId);
|
||||
comment.HasIndex(x => x.ContentItemId);
|
||||
comment.HasIndex(x => x.ParentCommentId);
|
||||
});
|
||||
|
||||
return modelBuilder;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user