//
using System;
using System.Collections.Generic;
using MessageService.Infrastructure;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MessageService.Infrastructure.Migrations
{
[DbContext(typeof(MessageDbContext))]
partial class MessageDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
modelBuilder.Entity("MessageService.Domain.Entities.Conversation", b =>
{
b.Property("ActiveConversationKey")
.ValueGeneratedOnAddOrUpdate()
.HasMaxLength(96)
.HasColumnType("varchar(96)")
.HasComputedColumnSql("CASE WHEN `IsDeleted` = 0 THEN CONCAT(`UserId`, ':', `ChatType`, ':', `TargetId`) ELSE NULL END", true);
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property("ChatType")
.HasColumnType("int");
b.Property("CreationTime")
.HasColumnType("datetime(6)");
b.Property("Deletion")
.HasColumnType("datetime(6)");
b.Property("IsDeleted")
.HasColumnType("tinyint(1)");
b.Property("LastMessage")
.IsRequired()
.HasColumnType("longtext");
b.Property("LastMessageTime")
.HasColumnType("datetime(6)");
b.Property("LastReadSequenceId")
.HasColumnType("bigint");
b.Property("ModificationTime")
.HasColumnType("datetime(6)");
b.Property("StreamKey")
.IsRequired()
.HasColumnType("longtext");
b.Property("TargetAvatar")
.IsRequired()
.HasColumnType("longtext");
b.Property("TargetId")
.HasColumnType("char(36)");
b.Property("TargetName")
.IsRequired()
.HasColumnType("longtext");
b.Property("UnreadCount")
.HasColumnType("int");
b.Property("UserId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("ActiveConversationKey")
.IsUnique()
.HasDatabaseName("UX_conversations_ActiveConversationKey");
b.HasIndex("UserId");
b.HasIndex("UserId", "ChatType", "TargetId", "IsDeleted");
b.ToTable("conversations", (string)null);
});
modelBuilder.Entity("MessageService.Domain.Entities.Message", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property("ChatType")
.HasColumnType("int");
b.Property("ClientMsgId")
.HasColumnType("char(36)");
b.Property("CreationTime")
.HasColumnType("datetime(6)");
b.Property("Deletion")
.HasColumnType("datetime(6)");
b.Property("IsDeleted")
.HasColumnType("tinyint(1)");
b.Property("ModificationTime")
.HasColumnType("datetime(6)");
b.Property("MsgType")
.HasColumnType("int");
b.Property("SenderId")
.HasColumnType("char(36)");
b.Property("SequenceId")
.HasColumnType("bigint");
b.Property("State")
.HasColumnType("int");
b.Property("StreamKey")
.IsRequired()
.HasColumnType("varchar(255)");
b.Property("TargetId")
.HasColumnType("char(36)");
b.ComplexProperty>("Content", "MessageService.Domain.Entities.Message.Content#MessageContent", b1 =>
{
b1.IsRequired();
b1.Property("Fallback")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("varchar(255)")
.HasAnnotation("Relational:JsonPropertyName", "fallback");
b1.Property("RawBody")
.IsRequired()
.HasColumnType("longtext")
.HasColumnName("Content_Body");
b1.Property("RawExt")
.IsRequired()
.HasColumnType("longtext")
.HasColumnName("Content_Ext");
b1.ComplexProperty>("Quote", "MessageService.Domain.Entities.Message.Content#MessageContent.Quote#QuoteInfo", b2 =>
{
b2.IsRequired();
b2.Property("MessageId")
.HasColumnType("char(36)")
.HasColumnName("Quote_MsgId");
b2.Property("MessageType")
.HasColumnType("int")
.HasColumnName("Quote_MsgType");
b2.Property("Preview")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasColumnName("Quote_Preview");
b2.Property("SenderId")
.HasColumnType("char(36)")
.HasColumnName("Quote_SenderId");
b2.Property("SenderName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasColumnName("Quote_SenderName");
});
});
b.HasKey("Id");
b.HasIndex("StreamKey", "SequenceId");
b.HasIndex("StreamKey", "MsgType", "State", "SequenceId");
b.ToTable("messages", (string)null);
});
#pragma warning restore 612, 618
}
}
}