//
using System;
using System.Collections.Generic;
using Govor.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Govor.Data.Migrations
{
[DbContext(typeof(GovorDbContext))]
partial class GovorDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Govor.Core.Models.Admin", b =>
{
b.Property("UserId")
.HasColumnType("uuid");
b.HasKey("UserId");
b.ToTable("Admins");
});
modelBuilder.Entity("Govor.Core.Models.ChatGroup", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.PrimitiveCollection>("Admins")
.IsRequired()
.HasColumnType("uuid[]");
b.PrimitiveCollection>("InviteCode")
.IsRequired()
.HasColumnType("text[]");
b.Property("IsChannel")
.HasColumnType("boolean");
b.Property("IsPrivate")
.HasColumnType("boolean");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ChatGroups");
});
modelBuilder.Entity("Govor.Core.Models.GroupAdmins", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("GroupId")
.HasColumnType("uuid");
b.Property("UserId")
.HasColumnType("uuid");
b.HasKey("Id");
b.ToTable("GroupAdmins");
});
modelBuilder.Entity("Govor.Core.Models.GroupMembership", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("GroupId")
.HasColumnType("uuid");
b.Property("IsBanned")
.HasColumnType("boolean");
b.Property("UserId")
.HasColumnType("uuid");
b.HasKey("Id");
b.ToTable("GroupMemberships");
});
modelBuilder.Entity("Govor.Core.Models.Invitation", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property("EndDate")
.HasColumnType("timestamp with time zone");
b.Property("IsAdmin")
.HasColumnType("boolean");
b.Property("MaxParticipants")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("Invitations");
});
modelBuilder.Entity("Govor.Core.Models.MediaAttachments", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("EncryptedKey")
.HasMaxLength(512)
.HasColumnType("character varying(512)");
b.Property("FilePath")
.IsRequired()
.HasColumnType("text");
b.Property("MessageId")
.HasColumnType("uuid");
b.Property("MimeType")
.IsRequired()
.HasColumnType("text");
b.Property("Type")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("MessageId");
b.ToTable("MediaAttachments");
});
modelBuilder.Entity("Govor.Core.Models.Message", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("EditedAt")
.HasColumnType("timestamp with time zone");
b.Property("EncryptedContent")
.IsRequired()
.HasColumnType("text");
b.Property("IsEdited")
.HasColumnType("boolean");
b.Property("RecipientId")
.HasColumnType("uuid");
b.Property("RecipientType")
.HasColumnType("integer");
b.Property("ReplyToMessageId")
.HasColumnType("uuid");
b.Property("SenderId")
.HasColumnType("uuid");
b.Property("SentAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("ReplyToMessageId");
b.ToTable("Messages");
});
modelBuilder.Entity("Govor.Core.Models.MessageReaction", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("MessageId")
.HasColumnType("uuid");
b.Property("ReactedAt")
.HasColumnType("timestamp with time zone");
b.Property("ReactionCode")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("UserId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("MessageId", "UserId")
.IsUnique();
b.ToTable("MessageReactions");
});
modelBuilder.Entity("Govor.Core.Models.MessageView", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("MessageId")
.HasColumnType("uuid");
b.Property("UserId")
.HasColumnType("uuid");
b.Property("ViewedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("MessageId", "UserId")
.IsUnique();
b.ToTable("MessageViews");
});
modelBuilder.Entity("Govor.Core.Models.User", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedOn")
.HasColumnType("date");
b.Property("Description")
.IsRequired()
.HasColumnType("text");
b.Property("IconId")
.HasColumnType("uuid");
b.Property("InviteId")
.HasColumnType("uuid");
b.Property("PasswordHash")
.IsRequired()
.HasColumnType("text");
b.Property("Username")
.IsRequired()
.HasColumnType("text");
b.Property("WasOnline")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("InviteId");
b.ToTable("Users");
});
modelBuilder.Entity("Govor.Core.Models.Admin", b =>
{
b.HasOne("Govor.Core.Models.User", "User")
.WithOne()
.HasForeignKey("Govor.Core.Models.Admin", "UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("Govor.Core.Models.MediaAttachments", b =>
{
b.HasOne("Govor.Core.Models.Message", "Message")
.WithMany("MediaAttachments")
.HasForeignKey("MessageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Message");
});
modelBuilder.Entity("Govor.Core.Models.Message", b =>
{
b.HasOne("Govor.Core.Models.Message", "ReplyToMessage")
.WithMany()
.HasForeignKey("ReplyToMessageId")
.OnDelete(DeleteBehavior.Restrict);
b.Navigation("ReplyToMessage");
});
modelBuilder.Entity("Govor.Core.Models.MessageReaction", b =>
{
b.HasOne("Govor.Core.Models.Message", "Message")
.WithMany("Reactions")
.HasForeignKey("MessageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Govor.Core.Models.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Message");
b.Navigation("User");
});
modelBuilder.Entity("Govor.Core.Models.MessageView", b =>
{
b.HasOne("Govor.Core.Models.Message", null)
.WithMany("MessageViews")
.HasForeignKey("MessageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Govor.Core.Models.User", b =>
{
b.HasOne("Govor.Core.Models.Invitation", "Invite")
.WithMany("Users")
.HasForeignKey("InviteId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Invite");
});
modelBuilder.Entity("Govor.Core.Models.Invitation", b =>
{
b.Navigation("Users");
});
modelBuilder.Entity("Govor.Core.Models.Message", b =>
{
b.Navigation("MediaAttachments");
b.Navigation("MessageViews");
b.Navigation("Reactions");
});
#pragma warning restore 612, 618
}
}
}