mirror of
https://github.com/Govor-team/Govor.git
synced 2026-11-18 05:15:06 +00:00
Add reactions, reliable push & session checks
Implements message reactions and reaction packs (domain models, services, admin HTTP API, media processing via ImageSharp and limits) and adds reliable push delivery (ChatPushNotification, ChatPushDispatcher, ChatPushWorker, improved ChatNotificationService). Enhances message reading (ReadChat API, unread counts, concurrency-safe receipts) and tightens session security (access-token session validation in JWT, hub filter, SessionAuthorization). Improves SignalR behavior (session groups, reaction/channel events, hub/error mappings). Adds EF migrations, many controller fixes (Forbid handling, password API), tests (Govor.Server.Tests), docs, CI and tooling updates (Dockerfile → .NET 10, GH Actions matrix for sqlite/postgres, Govor.Server.slnx, global.json), and small infra changes (AutoMapper bump, NullPushProvider, storage/token handling).
This commit is contained in:
@@ -0,0 +1,878 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Govor.Domain;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Govor.Domain.Migrations
|
||||
{
|
||||
[DbContext(typeof(GovorDbContext))]
|
||||
[Migration("20261003070406_ReliableChatPush")]
|
||||
partial class ReliableChatPush
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.10")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.ChatGroup", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("character varying(500)");
|
||||
|
||||
b.Property<Guid>("ImageId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<bool>("IsChannel")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsPrivate")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ChatGroups");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Friendship", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("AddresseeId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("RequesterId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AddresseeId");
|
||||
|
||||
b.HasIndex("RequesterId");
|
||||
|
||||
b.ToTable("Friendships");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.GroupAdmins", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("GroupId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.ToTable("GroupAdmins");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.GroupInvitation", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("character varying(500)");
|
||||
|
||||
b.Property<DateTime>("EndDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("GroupId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("InvitationCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)");
|
||||
|
||||
b.Property<int>("MaxParticipants")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid>("UserMakerId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.HasIndex("UserMakerId");
|
||||
|
||||
b.ToTable("GroupInvitations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.GroupMembership", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("ChatGroupId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("GroupId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("InvitationId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<bool>("IsBanned")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("MemberSince")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ChatGroupId");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.HasIndex("InvitationId");
|
||||
|
||||
b.ToTable("GroupMemberships");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Invitation", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("EndDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsAdmin")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("MaxParticipants")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Participants")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Invitations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.MediaFile", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("MediaType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("MineType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b.Property<Guid?>("OwnerId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("OwnerType")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid>("UploaderId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("MediaFiles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Messages.ChatPushNotification", b =>
|
||||
{
|
||||
b.Property<Guid>("MessageId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("Attempts")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("NextAttemptAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("MessageId");
|
||||
|
||||
b.HasIndex("NextAttemptAt");
|
||||
|
||||
b.ToTable("ChatPushNotifications");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Messages.MediaAttachments", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("MediaFileId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("MessageId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MediaFileId");
|
||||
|
||||
b.HasIndex("MessageId");
|
||||
|
||||
b.ToTable("MediaAttachments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Messages.Message", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("ChatGroupId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime?>("EditedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("EncryptedContent")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsEdited")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<Guid?>("PrivateChatId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("RecipientId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("RecipientType")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid?>("ReplyToMessageId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("SenderId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("SentAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ChatGroupId");
|
||||
|
||||
b.HasIndex("PrivateChatId");
|
||||
|
||||
b.HasIndex("RecipientId");
|
||||
|
||||
b.ToTable("Messages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Messages.MessageReaction", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("MessageId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("ReactedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("ReactionCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.HasIndex("MessageId", "UserId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("MessageReactions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Messages.MessageView", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("MessageId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("ViewedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MessageId", "UserId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("MessageViews");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.PrivateChat", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("UserAId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("UserBId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("PrivateChats");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Users.Admin", b =>
|
||||
{
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("UserId");
|
||||
|
||||
b.ToTable("Admins");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Users.Crypto.OneTimePreKey", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<bool>("IsUsed")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("boolean")
|
||||
.HasDefaultValue(false);
|
||||
|
||||
b.Property<byte[]>("PublicKey")
|
||||
.IsRequired()
|
||||
.HasColumnType("bytea");
|
||||
|
||||
b.Property<DateTime>("UploadedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("UserCryptoSessionId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UploadedAt");
|
||||
|
||||
b.HasIndex("UserCryptoSessionId", "IsUsed");
|
||||
|
||||
b.ToTable("OneTimePreKeys");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Users.Crypto.SignedPreKey", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<byte[]>("PublicSignedPreKey")
|
||||
.IsRequired()
|
||||
.HasColumnType("bytea");
|
||||
|
||||
b.Property<byte[]>("SignedPreKeySignature")
|
||||
.IsRequired()
|
||||
.HasColumnType("bytea");
|
||||
|
||||
b.Property<Guid>("UserCryptoSessionId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserCryptoSessionId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("SignedPreKeys");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Users.Crypto.UserCryptoSession", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<byte[]>("PublicIdentityKey")
|
||||
.IsRequired()
|
||||
.HasColumnType("bytea");
|
||||
|
||||
b.Property<Guid>("UserSessionId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserSessionId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("UserCryptoSessions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Users.User", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateOnly>("CreatedOn")
|
||||
.HasColumnType("date");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("character varying(500)");
|
||||
|
||||
b.Property<Guid>("IconId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("InviteId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b.Property<string>("Username")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<DateTime>("WasOnline")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreatedOn");
|
||||
|
||||
b.HasIndex("InviteId");
|
||||
|
||||
b.HasIndex("Username")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("WasOnline");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Users.UserPushToken", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime?>("LastUsedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Platform")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<string>("Provider")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<string>("Token")
|
||||
.IsRequired()
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("character varying(512)");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("UserSessionId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Token")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("UserSessionId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("UserId", "IsActive");
|
||||
|
||||
b.ToTable("UserPushTokens");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Users.UserSession", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("DeviceInfo")
|
||||
.IsRequired()
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<DateTime>("ExpiresAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsRevoked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("RefreshTokenHash")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RefreshTokenHash")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("UserSessions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Friendship", b =>
|
||||
{
|
||||
b.HasOne("Govor.Domain.Models.Users.User", "Addressee")
|
||||
.WithMany("ReceivedFriendRequests")
|
||||
.HasForeignKey("AddresseeId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Govor.Domain.Models.Users.User", "Requester")
|
||||
.WithMany("SentFriendRequests")
|
||||
.HasForeignKey("RequesterId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Addressee");
|
||||
|
||||
b.Navigation("Requester");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.GroupAdmins", b =>
|
||||
{
|
||||
b.HasOne("Govor.Domain.Models.ChatGroup", null)
|
||||
.WithMany("Admins")
|
||||
.HasForeignKey("GroupId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.GroupInvitation", b =>
|
||||
{
|
||||
b.HasOne("Govor.Domain.Models.ChatGroup", null)
|
||||
.WithMany("InviteCodes")
|
||||
.HasForeignKey("GroupId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Govor.Domain.Models.Users.User", "UserMaker")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserMakerId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("UserMaker");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.GroupMembership", b =>
|
||||
{
|
||||
b.HasOne("Govor.Domain.Models.ChatGroup", null)
|
||||
.WithMany("Members")
|
||||
.HasForeignKey("ChatGroupId");
|
||||
|
||||
b.HasOne("Govor.Domain.Models.ChatGroup", "ChatGroup")
|
||||
.WithMany()
|
||||
.HasForeignKey("GroupId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Govor.Domain.Models.GroupInvitation", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("InvitationId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("ChatGroup");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Messages.ChatPushNotification", b =>
|
||||
{
|
||||
b.HasOne("Govor.Domain.Models.Messages.Message", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("MessageId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Messages.MediaAttachments", b =>
|
||||
{
|
||||
b.HasOne("Govor.Domain.Models.MediaFile", "MediaFile")
|
||||
.WithMany()
|
||||
.HasForeignKey("MediaFileId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Govor.Domain.Models.Messages.Message", "Message")
|
||||
.WithMany("MediaAttachments")
|
||||
.HasForeignKey("MessageId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("MediaFile");
|
||||
|
||||
b.Navigation("Message");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Messages.Message", b =>
|
||||
{
|
||||
b.HasOne("Govor.Domain.Models.ChatGroup", null)
|
||||
.WithMany("Messages")
|
||||
.HasForeignKey("ChatGroupId");
|
||||
|
||||
b.HasOne("Govor.Domain.Models.PrivateChat", null)
|
||||
.WithMany("Messages")
|
||||
.HasForeignKey("PrivateChatId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Messages.MessageReaction", b =>
|
||||
{
|
||||
b.HasOne("Govor.Domain.Models.Messages.Message", "Message")
|
||||
.WithMany("Reactions")
|
||||
.HasForeignKey("MessageId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Govor.Domain.Models.Users.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Message");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Messages.MessageView", b =>
|
||||
{
|
||||
b.HasOne("Govor.Domain.Models.Messages.Message", null)
|
||||
.WithMany("MessageViews")
|
||||
.HasForeignKey("MessageId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Users.Admin", b =>
|
||||
{
|
||||
b.HasOne("Govor.Domain.Models.Users.User", "User")
|
||||
.WithOne()
|
||||
.HasForeignKey("Govor.Domain.Models.Users.Admin", "UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Users.Crypto.OneTimePreKey", b =>
|
||||
{
|
||||
b.HasOne("Govor.Domain.Models.Users.Crypto.UserCryptoSession", "UserCryptoSession")
|
||||
.WithMany("OneTimePreKeys")
|
||||
.HasForeignKey("UserCryptoSessionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("UserCryptoSession");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Users.Crypto.SignedPreKey", b =>
|
||||
{
|
||||
b.HasOne("Govor.Domain.Models.Users.Crypto.UserCryptoSession", "UserCryptoSession")
|
||||
.WithOne("SignedPreKey")
|
||||
.HasForeignKey("Govor.Domain.Models.Users.Crypto.SignedPreKey", "UserCryptoSessionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("UserCryptoSession");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Users.Crypto.UserCryptoSession", b =>
|
||||
{
|
||||
b.HasOne("Govor.Domain.Models.Users.UserSession", "UserSession")
|
||||
.WithOne("CryptoSession")
|
||||
.HasForeignKey("Govor.Domain.Models.Users.Crypto.UserCryptoSession", "UserSessionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("UserSession");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Users.User", b =>
|
||||
{
|
||||
b.HasOne("Govor.Domain.Models.Invitation", "Invite")
|
||||
.WithMany("Users")
|
||||
.HasForeignKey("InviteId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Invite");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Users.UserSession", b =>
|
||||
{
|
||||
b.HasOne("Govor.Domain.Models.Users.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.ChatGroup", b =>
|
||||
{
|
||||
b.Navigation("Admins");
|
||||
|
||||
b.Navigation("InviteCodes");
|
||||
|
||||
b.Navigation("Members");
|
||||
|
||||
b.Navigation("Messages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Invitation", b =>
|
||||
{
|
||||
b.Navigation("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Messages.Message", b =>
|
||||
{
|
||||
b.Navigation("MediaAttachments");
|
||||
|
||||
b.Navigation("MessageViews");
|
||||
|
||||
b.Navigation("Reactions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.PrivateChat", b =>
|
||||
{
|
||||
b.Navigation("Messages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Users.Crypto.UserCryptoSession", b =>
|
||||
{
|
||||
b.Navigation("OneTimePreKeys");
|
||||
|
||||
b.Navigation("SignedPreKey")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Users.User", b =>
|
||||
{
|
||||
b.Navigation("ReceivedFriendRequests");
|
||||
|
||||
b.Navigation("SentFriendRequests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Users.UserSession", b =>
|
||||
{
|
||||
b.Navigation("CryptoSession")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Govor.Domain.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class ReliableChatPush : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ChatPushNotifications",
|
||||
columns: table => new
|
||||
{
|
||||
MessageId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
NextAttemptAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
Attempts = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ChatPushNotifications", x => x.MessageId);
|
||||
table.ForeignKey(
|
||||
name: "FK_ChatPushNotifications_Messages_MessageId",
|
||||
column: x => x.MessageId,
|
||||
principalTable: "Messages",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ChatPushNotifications_NextAttemptAt",
|
||||
table: "ChatPushNotifications",
|
||||
column: "NextAttemptAt");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "ChatPushNotifications");
|
||||
}
|
||||
}
|
||||
}
|
||||
+1286
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,280 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace Govor.Domain.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class ReactionPacksAndChannelPolicies : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<long>(
|
||||
name: "ReactionsVersion",
|
||||
table: "Messages",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
defaultValue: 0L);
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "ReactionId",
|
||||
table: "MessageReactions",
|
||||
type: "uuid",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "ReactionMode",
|
||||
table: "ChatGroups",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<long>(
|
||||
name: "ReactionPolicyVersion",
|
||||
table: "ChatGroups",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
defaultValue: 0L);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ReactionPacks",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
|
||||
Description = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: false),
|
||||
ShareCode = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false),
|
||||
IsDefault = table.Column<bool>(type: "boolean", nullable: false),
|
||||
IsEnabled = table.Column<bool>(type: "boolean", nullable: false),
|
||||
CreatedByUserId = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ReactionPacks", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ReactionPacks_Users_CreatedByUserId",
|
||||
column: x => x.CreatedByUserId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ReactionItems",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
PackId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Code = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
||||
Name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
|
||||
Kind = table.Column<int>(type: "integer", nullable: false),
|
||||
Emoji = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
|
||||
MediaFileId = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
Width = table.Column<int>(type: "integer", nullable: false),
|
||||
Height = table.Column<int>(type: "integer", nullable: false),
|
||||
SizeBytes = table.Column<int>(type: "integer", nullable: false),
|
||||
DurationMilliseconds = table.Column<int>(type: "integer", nullable: false),
|
||||
IsEnabled = table.Column<bool>(type: "boolean", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ReactionItems", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ReactionItems_MediaFiles_MediaFileId",
|
||||
column: x => x.MediaFileId,
|
||||
principalTable: "MediaFiles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_ReactionItems_ReactionPacks_PackId",
|
||||
column: x => x.PackId,
|
||||
principalTable: "ReactionPacks",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "UserReactionPacks",
|
||||
columns: table => new
|
||||
{
|
||||
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
PackId = table.Column<Guid>(type: "uuid", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_UserReactionPacks", x => new { x.UserId, x.PackId });
|
||||
table.ForeignKey(
|
||||
name: "FK_UserReactionPacks_ReactionPacks_PackId",
|
||||
column: x => x.PackId,
|
||||
principalTable: "ReactionPacks",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_UserReactionPacks_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ChannelAllowedReactions",
|
||||
columns: table => new
|
||||
{
|
||||
GroupId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
ReactionId = table.Column<Guid>(type: "uuid", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ChannelAllowedReactions", x => new { x.GroupId, x.ReactionId });
|
||||
table.ForeignKey(
|
||||
name: "FK_ChannelAllowedReactions_ChatGroups_GroupId",
|
||||
column: x => x.GroupId,
|
||||
principalTable: "ChatGroups",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ChannelAllowedReactions_ReactionItems_ReactionId",
|
||||
column: x => x.ReactionId,
|
||||
principalTable: "ReactionItems",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "ReactionPacks",
|
||||
columns: new[] { "Id", "CreatedAt", "CreatedByUserId", "Description", "IsDefault", "IsEnabled", "Name", "ShareCode" },
|
||||
values: new object[] { new Guid("b3000000-0000-0000-0000-000000000001"), new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), null, "Default public emoji reactions", true, true, "Emoji", "default" });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "ReactionItems",
|
||||
columns: new[] { "Id", "Code", "CreatedAt", "DurationMilliseconds", "Emoji", "Height", "IsEnabled", "Kind", "MediaFileId", "Name", "PackId", "SizeBytes", "Width" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("b3000000-0000-0000-0001-000000000001"), "👍", new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), 0, "👍", 0, true, 0, null, "👍", new Guid("b3000000-0000-0000-0000-000000000001"), 0, 0 },
|
||||
{ new Guid("b3000000-0000-0000-0001-000000000002"), "👎", new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), 0, "👎", 0, true, 0, null, "👎", new Guid("b3000000-0000-0000-0000-000000000001"), 0, 0 },
|
||||
{ new Guid("b3000000-0000-0000-0001-000000000003"), "❤️", new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), 0, "❤️", 0, true, 0, null, "❤️", new Guid("b3000000-0000-0000-0000-000000000001"), 0, 0 },
|
||||
{ new Guid("b3000000-0000-0000-0001-000000000004"), "🔥", new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), 0, "🔥", 0, true, 0, null, "🔥", new Guid("b3000000-0000-0000-0000-000000000001"), 0, 0 },
|
||||
{ new Guid("b3000000-0000-0000-0001-000000000005"), "🥰", new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), 0, "🥰", 0, true, 0, null, "🥰", new Guid("b3000000-0000-0000-0000-000000000001"), 0, 0 },
|
||||
{ new Guid("b3000000-0000-0000-0001-000000000006"), "👏", new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), 0, "👏", 0, true, 0, null, "👏", new Guid("b3000000-0000-0000-0000-000000000001"), 0, 0 },
|
||||
{ new Guid("b3000000-0000-0000-0001-000000000007"), "😁", new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), 0, "😁", 0, true, 0, null, "😁", new Guid("b3000000-0000-0000-0000-000000000001"), 0, 0 },
|
||||
{ new Guid("b3000000-0000-0000-0001-000000000008"), "🤔", new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), 0, "🤔", 0, true, 0, null, "🤔", new Guid("b3000000-0000-0000-0000-000000000001"), 0, 0 },
|
||||
{ new Guid("b3000000-0000-0000-0001-000000000009"), "😢", new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), 0, "😢", 0, true, 0, null, "😢", new Guid("b3000000-0000-0000-0000-000000000001"), 0, 0 },
|
||||
{ new Guid("b3000000-0000-0000-0001-000000000010"), "🎉", new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), 0, "🎉", 0, true, 0, null, "🎉", new Guid("b3000000-0000-0000-0000-000000000001"), 0, 0 },
|
||||
{ new Guid("b3000000-0000-0000-0001-000000000011"), "🤯", new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), 0, "🤯", 0, true, 0, null, "🤯", new Guid("b3000000-0000-0000-0000-000000000001"), 0, 0 },
|
||||
{ new Guid("b3000000-0000-0000-0001-000000000012"), "🙏", new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), 0, "🙏", 0, true, 0, null, "🙏", new Guid("b3000000-0000-0000-0000-000000000001"), 0, 0 }
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MessageReactions_ReactionId",
|
||||
table: "MessageReactions",
|
||||
column: "ReactionId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ChannelAllowedReactions_ReactionId",
|
||||
table: "ChannelAllowedReactions",
|
||||
column: "ReactionId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ReactionItems_Code",
|
||||
table: "ReactionItems",
|
||||
column: "Code",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ReactionItems_MediaFileId",
|
||||
table: "ReactionItems",
|
||||
column: "MediaFileId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ReactionItems_PackId",
|
||||
table: "ReactionItems",
|
||||
column: "PackId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ReactionPacks_CreatedByUserId",
|
||||
table: "ReactionPacks",
|
||||
column: "CreatedByUserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ReactionPacks_IsDefault",
|
||||
table: "ReactionPacks",
|
||||
column: "IsDefault",
|
||||
unique: true,
|
||||
filter: "\"IsDefault\" = TRUE");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ReactionPacks_ShareCode",
|
||||
table: "ReactionPacks",
|
||||
column: "ShareCode",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_UserReactionPacks_PackId",
|
||||
table: "UserReactionPacks",
|
||||
column: "PackId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_MessageReactions_ReactionItems_ReactionId",
|
||||
table: "MessageReactions",
|
||||
column: "ReactionId",
|
||||
principalTable: "ReactionItems",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
// Link known legacy emoji receipts to the seeded catalogue; preserve unknown codes.
|
||||
migrationBuilder.Sql("""
|
||||
UPDATE "MessageReactions" AS mr
|
||||
SET "ReactionId" = (SELECT ri."Id" FROM "ReactionItems" AS ri
|
||||
WHERE ri."Code" = mr."ReactionCode" AND ri."PackId" = 'b3000000-0000-0000-0000-000000000001')
|
||||
WHERE mr."ReactionId" IS NULL AND EXISTS (SELECT 1 FROM "ReactionItems" AS ri
|
||||
WHERE ri."Code" = mr."ReactionCode" AND ri."PackId" = 'b3000000-0000-0000-0000-000000000001');
|
||||
""");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_MessageReactions_ReactionItems_ReactionId",
|
||||
table: "MessageReactions");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ChannelAllowedReactions");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "UserReactionPacks");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ReactionItems");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ReactionPacks");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_MessageReactions_ReactionId",
|
||||
table: "MessageReactions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ReactionsVersion",
|
||||
table: "Messages");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ReactionId",
|
||||
table: "MessageReactions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ReactionMode",
|
||||
table: "ChatGroups");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ReactionPolicyVersion",
|
||||
table: "ChatGroups");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,12 @@ namespace Govor.Domain.Migrations
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<int>("ReactionMode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<long>("ReactionPolicyVersion")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ChatGroups");
|
||||
@@ -243,6 +249,24 @@ namespace Govor.Domain.Migrations
|
||||
b.ToTable("MediaFiles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Messages.ChatPushNotification", b =>
|
||||
{
|
||||
b.Property<Guid>("MessageId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("Attempts")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("NextAttemptAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("MessageId");
|
||||
|
||||
b.HasIndex("NextAttemptAt");
|
||||
|
||||
b.ToTable("ChatPushNotifications");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Messages.MediaAttachments", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@@ -286,6 +310,9 @@ namespace Govor.Domain.Migrations
|
||||
b.Property<Guid?>("PrivateChatId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<long>("ReactionsVersion")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<Guid>("RecipientId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
@@ -329,11 +356,16 @@ namespace Govor.Domain.Migrations
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)");
|
||||
|
||||
b.Property<Guid?>("ReactionId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ReactionId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.HasIndex("MessageId", "UserId")
|
||||
@@ -382,6 +414,336 @@ namespace Govor.Domain.Migrations
|
||||
b.ToTable("PrivateChats");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Reactions.ChannelAllowedReaction", b =>
|
||||
{
|
||||
b.Property<Guid>("GroupId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("ReactionId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("GroupId", "ReactionId");
|
||||
|
||||
b.HasIndex("ReactionId");
|
||||
|
||||
b.ToTable("ChannelAllowedReactions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Reactions.ReactionItem", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("DurationMilliseconds")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Emoji")
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)");
|
||||
|
||||
b.Property<int>("Height")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("IsEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("Kind")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid?>("MediaFileId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<Guid>("PackId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("SizeBytes")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Width")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Code")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("MediaFileId");
|
||||
|
||||
b.HasIndex("PackId");
|
||||
|
||||
b.ToTable("ReactionItems");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("b3000000-0000-0000-0001-000000000001"),
|
||||
Code = "👍",
|
||||
CreatedAt = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
DurationMilliseconds = 0,
|
||||
Emoji = "👍",
|
||||
Height = 0,
|
||||
IsEnabled = true,
|
||||
Kind = 0,
|
||||
Name = "👍",
|
||||
PackId = new Guid("b3000000-0000-0000-0000-000000000001"),
|
||||
SizeBytes = 0,
|
||||
Width = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("b3000000-0000-0000-0001-000000000002"),
|
||||
Code = "👎",
|
||||
CreatedAt = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
DurationMilliseconds = 0,
|
||||
Emoji = "👎",
|
||||
Height = 0,
|
||||
IsEnabled = true,
|
||||
Kind = 0,
|
||||
Name = "👎",
|
||||
PackId = new Guid("b3000000-0000-0000-0000-000000000001"),
|
||||
SizeBytes = 0,
|
||||
Width = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("b3000000-0000-0000-0001-000000000003"),
|
||||
Code = "❤️",
|
||||
CreatedAt = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
DurationMilliseconds = 0,
|
||||
Emoji = "❤️",
|
||||
Height = 0,
|
||||
IsEnabled = true,
|
||||
Kind = 0,
|
||||
Name = "❤️",
|
||||
PackId = new Guid("b3000000-0000-0000-0000-000000000001"),
|
||||
SizeBytes = 0,
|
||||
Width = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("b3000000-0000-0000-0001-000000000004"),
|
||||
Code = "🔥",
|
||||
CreatedAt = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
DurationMilliseconds = 0,
|
||||
Emoji = "🔥",
|
||||
Height = 0,
|
||||
IsEnabled = true,
|
||||
Kind = 0,
|
||||
Name = "🔥",
|
||||
PackId = new Guid("b3000000-0000-0000-0000-000000000001"),
|
||||
SizeBytes = 0,
|
||||
Width = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("b3000000-0000-0000-0001-000000000005"),
|
||||
Code = "🥰",
|
||||
CreatedAt = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
DurationMilliseconds = 0,
|
||||
Emoji = "🥰",
|
||||
Height = 0,
|
||||
IsEnabled = true,
|
||||
Kind = 0,
|
||||
Name = "🥰",
|
||||
PackId = new Guid("b3000000-0000-0000-0000-000000000001"),
|
||||
SizeBytes = 0,
|
||||
Width = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("b3000000-0000-0000-0001-000000000006"),
|
||||
Code = "👏",
|
||||
CreatedAt = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
DurationMilliseconds = 0,
|
||||
Emoji = "👏",
|
||||
Height = 0,
|
||||
IsEnabled = true,
|
||||
Kind = 0,
|
||||
Name = "👏",
|
||||
PackId = new Guid("b3000000-0000-0000-0000-000000000001"),
|
||||
SizeBytes = 0,
|
||||
Width = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("b3000000-0000-0000-0001-000000000007"),
|
||||
Code = "😁",
|
||||
CreatedAt = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
DurationMilliseconds = 0,
|
||||
Emoji = "😁",
|
||||
Height = 0,
|
||||
IsEnabled = true,
|
||||
Kind = 0,
|
||||
Name = "😁",
|
||||
PackId = new Guid("b3000000-0000-0000-0000-000000000001"),
|
||||
SizeBytes = 0,
|
||||
Width = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("b3000000-0000-0000-0001-000000000008"),
|
||||
Code = "🤔",
|
||||
CreatedAt = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
DurationMilliseconds = 0,
|
||||
Emoji = "🤔",
|
||||
Height = 0,
|
||||
IsEnabled = true,
|
||||
Kind = 0,
|
||||
Name = "🤔",
|
||||
PackId = new Guid("b3000000-0000-0000-0000-000000000001"),
|
||||
SizeBytes = 0,
|
||||
Width = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("b3000000-0000-0000-0001-000000000009"),
|
||||
Code = "😢",
|
||||
CreatedAt = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
DurationMilliseconds = 0,
|
||||
Emoji = "😢",
|
||||
Height = 0,
|
||||
IsEnabled = true,
|
||||
Kind = 0,
|
||||
Name = "😢",
|
||||
PackId = new Guid("b3000000-0000-0000-0000-000000000001"),
|
||||
SizeBytes = 0,
|
||||
Width = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("b3000000-0000-0000-0001-000000000010"),
|
||||
Code = "🎉",
|
||||
CreatedAt = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
DurationMilliseconds = 0,
|
||||
Emoji = "🎉",
|
||||
Height = 0,
|
||||
IsEnabled = true,
|
||||
Kind = 0,
|
||||
Name = "🎉",
|
||||
PackId = new Guid("b3000000-0000-0000-0000-000000000001"),
|
||||
SizeBytes = 0,
|
||||
Width = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("b3000000-0000-0000-0001-000000000011"),
|
||||
Code = "🤯",
|
||||
CreatedAt = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
DurationMilliseconds = 0,
|
||||
Emoji = "🤯",
|
||||
Height = 0,
|
||||
IsEnabled = true,
|
||||
Kind = 0,
|
||||
Name = "🤯",
|
||||
PackId = new Guid("b3000000-0000-0000-0000-000000000001"),
|
||||
SizeBytes = 0,
|
||||
Width = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("b3000000-0000-0000-0001-000000000012"),
|
||||
Code = "🙏",
|
||||
CreatedAt = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
DurationMilliseconds = 0,
|
||||
Emoji = "🙏",
|
||||
Height = 0,
|
||||
IsEnabled = true,
|
||||
Kind = 0,
|
||||
Name = "🙏",
|
||||
PackId = new Guid("b3000000-0000-0000-0000-000000000001"),
|
||||
SizeBytes = 0,
|
||||
Width = 0
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Reactions.ReactionPack", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid?>("CreatedByUserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("character varying(500)");
|
||||
|
||||
b.Property<bool>("IsDefault")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<string>("ShareCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("character varying(32)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreatedByUserId");
|
||||
|
||||
b.HasIndex("IsDefault")
|
||||
.IsUnique()
|
||||
.HasFilter("\"IsDefault\" = TRUE");
|
||||
|
||||
b.HasIndex("ShareCode")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("ReactionPacks");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("b3000000-0000-0000-0000-000000000001"),
|
||||
CreatedAt = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
Description = "Default public emoji reactions",
|
||||
IsDefault = true,
|
||||
IsEnabled = true,
|
||||
Name = "Emoji",
|
||||
ShareCode = "default"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Reactions.UserReactionPack", b =>
|
||||
{
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("PackId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("UserId", "PackId");
|
||||
|
||||
b.HasIndex("PackId");
|
||||
|
||||
b.ToTable("UserReactionPacks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Users.Admin", b =>
|
||||
{
|
||||
b.Property<Guid>("UserId")
|
||||
@@ -668,6 +1030,15 @@ namespace Govor.Domain.Migrations
|
||||
b.Navigation("ChatGroup");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Messages.ChatPushNotification", b =>
|
||||
{
|
||||
b.HasOne("Govor.Domain.Models.Messages.Message", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("MessageId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Messages.MediaAttachments", b =>
|
||||
{
|
||||
b.HasOne("Govor.Domain.Models.MediaFile", "MediaFile")
|
||||
@@ -706,6 +1077,11 @@ namespace Govor.Domain.Migrations
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Govor.Domain.Models.Reactions.ReactionItem", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ReactionId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("Govor.Domain.Models.Users.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
@@ -726,6 +1102,60 @@ namespace Govor.Domain.Migrations
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Reactions.ChannelAllowedReaction", b =>
|
||||
{
|
||||
b.HasOne("Govor.Domain.Models.ChatGroup", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("GroupId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Govor.Domain.Models.Reactions.ReactionItem", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ReactionId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Reactions.ReactionItem", b =>
|
||||
{
|
||||
b.HasOne("Govor.Domain.Models.MediaFile", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("MediaFileId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("Govor.Domain.Models.Reactions.ReactionPack", "Pack")
|
||||
.WithMany("Reactions")
|
||||
.HasForeignKey("PackId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Pack");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Reactions.ReactionPack", b =>
|
||||
{
|
||||
b.HasOne("Govor.Domain.Models.Users.User", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedByUserId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Reactions.UserReactionPack", b =>
|
||||
{
|
||||
b.HasOne("Govor.Domain.Models.Reactions.ReactionPack", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("PackId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Govor.Domain.Models.Users.User", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Users.Admin", b =>
|
||||
{
|
||||
b.HasOne("Govor.Domain.Models.Users.User", "User")
|
||||
@@ -822,6 +1252,11 @@ namespace Govor.Domain.Migrations
|
||||
b.Navigation("Messages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Reactions.ReactionPack", b =>
|
||||
{
|
||||
b.Navigation("Reactions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Domain.Models.Users.Crypto.UserCryptoSession", b =>
|
||||
{
|
||||
b.Navigation("OneTimePreKeys");
|
||||
|
||||
Reference in New Issue
Block a user