//
using System;
using Knot.Modules.Conversations.Infrastructure.Persistence;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Knot.Modules.Conversations.Migrations
{
[DbContext(typeof(ChatsDbContext))]
[Migration("20260322191932_InitialConversations")]
partial class InitialConversations
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("chats")
.HasAnnotation("ProductVersion", "10.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Knot.Contracts.Conversations.Domain.Chat", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Avatar")
.HasColumnType("text");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("Description")
.HasColumnType("text");
b.Property("LastMessageSequenceId")
.HasColumnType("bigint");
b.Property("Name")
.HasColumnType("text");
b.Property("Type")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Chats", "chats");
});
modelBuilder.Entity("Knot.Contracts.Conversations.Domain.Chat", b =>
{
b.OwnsMany("Knot.Contracts.Conversations.Domain.ChatMember", "Members", b1 =>
{
b1.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b1.Property("ChatId")
.HasColumnType("uuid");
b1.Property("IsMuted")
.HasColumnType("boolean");
b1.Property("IsPinned")
.HasColumnType("boolean");
b1.Property("JoinedAt")
.HasColumnType("timestamp with time zone");
b1.Property("LastDeliveredMessageId")
.HasColumnType("uuid");
b1.Property("LastReadMessageId")
.HasColumnType("uuid");
b1.Property("LastReadSequenceId")
.HasColumnType("bigint");
b1.Property("Role")
.IsRequired()
.HasColumnType("text");
b1.Property("UserId")
.HasColumnType("uuid");
b1.HasKey("Id");
b1.HasIndex("ChatId", "UserId")
.IsUnique();
b1.ToTable("ChatMembers", "chats");
b1.WithOwner()
.HasForeignKey("ChatId");
});
b.Navigation("Members");
});
#pragma warning restore 612, 618
}
}
}