Added IsUnicode(false) to hostname, version, status, IP, hash, prefix, key, URL, timezone, theme, language, YOLO model name, and enum-based string columns. These columns only contain ASCII data — disabling Unicode improves PostgreSQL index efficiency and reduces storage. Excluded natural text columns (Address, DisplayName, Site.Name) that may contain Unicode characters like accented letters.
40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using Heimdall.Domain.Entities;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace Heimdall.Infrastructure.Data.Configurations;
|
|
|
|
public class CameraCredentialsConfiguration : IEntityTypeConfiguration<CameraCredentials>
|
|
{
|
|
public void Configure(EntityTypeBuilder<CameraCredentials> builder)
|
|
{
|
|
builder.ToTable("camera_credentials");
|
|
|
|
builder.HasKey(c => c.CameraId);
|
|
|
|
builder.Property(c => c.OnvifUsername)
|
|
.HasMaxLength(100)
|
|
.HasDefaultValue("admin")
|
|
.IsUnicode(false);
|
|
|
|
builder.Property(c => c.OnvifPassword)
|
|
.HasMaxLength(500)
|
|
.IsRequired()
|
|
.IsUnicode(false);
|
|
|
|
builder.Property(c => c.RtspUsername)
|
|
.HasMaxLength(100)
|
|
.IsUnicode(false);
|
|
|
|
builder.Property(c => c.RtspPassword)
|
|
.HasMaxLength(500)
|
|
.IsUnicode(false);
|
|
|
|
builder.Property(c => c.CreatedAt)
|
|
.HasDefaultValueSql("NOW()");
|
|
|
|
builder.Property(c => c.UpdatedAt)
|
|
.HasDefaultValueSql("NOW()");
|
|
}
|
|
}
|