🗃️ Add migration for chat read at refactor
This commit is contained in:
parent
213d81a5ca
commit
b905d674b7
3396
DysonNetwork.Sphere/Migrations/20250523172951_RefactorChatLastRead.Designer.cs
generated
Normal file
3396
DysonNetwork.Sphere/Migrations/20250523172951_RefactorChatLastRead.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,89 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using NodaTime;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DysonNetwork.Sphere.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class RefactorChatLastRead : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "chat_read_receipts");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "type",
|
||||
table: "chat_messages",
|
||||
type: "character varying(1024)",
|
||||
maxLength: 1024,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text");
|
||||
|
||||
migrationBuilder.AddColumn<Instant>(
|
||||
name: "last_read_at",
|
||||
table: "chat_members",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "last_read_at",
|
||||
table: "chat_members");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "type",
|
||||
table: "chat_messages",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(1024)",
|
||||
oldMaxLength: 1024);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "chat_read_receipts",
|
||||
columns: table => new
|
||||
{
|
||||
message_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
sender_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
||||
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
|
||||
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_chat_read_receipts", x => new { x.message_id, x.sender_id });
|
||||
table.ForeignKey(
|
||||
name: "fk_chat_read_receipts_chat_members_sender_id",
|
||||
column: x => x.sender_id,
|
||||
principalTable: "chat_members",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "fk_chat_read_receipts_chat_messages_message_id",
|
||||
column: x => x.message_id,
|
||||
principalTable: "chat_messages",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_chat_read_receipts_message_id_sender_id",
|
||||
table: "chat_read_receipts",
|
||||
columns: new[] { "message_id", "sender_id" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_chat_read_receipts_sender_id",
|
||||
table: "chat_read_receipts",
|
||||
column: "sender_id");
|
||||
}
|
||||
}
|
||||
}
|
@ -945,6 +945,10 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("joined_at");
|
||||
|
||||
b.Property<Instant?>("LastReadAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("last_read_at");
|
||||
|
||||
b.Property<Instant?>("LeaveAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("leave_at");
|
||||
@ -1104,7 +1108,8 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasMaxLength(1024)
|
||||
.HasColumnType("character varying(1024)")
|
||||
.HasColumnName("type");
|
||||
|
||||
b.Property<Instant>("UpdatedAt")
|
||||
@ -1178,41 +1183,6 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
b.ToTable("chat_reactions", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReadReceipt", b =>
|
||||
{
|
||||
b.Property<Guid>("MessageId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("message_id");
|
||||
|
||||
b.Property<Guid>("SenderId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("sender_id");
|
||||
|
||||
b.Property<Instant>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<Instant?>("DeletedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("deleted_at");
|
||||
|
||||
b.Property<Instant>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("MessageId", "SenderId")
|
||||
.HasName("pk_chat_read_receipts");
|
||||
|
||||
b.HasIndex("SenderId")
|
||||
.HasDatabaseName("ix_chat_read_receipts_sender_id");
|
||||
|
||||
b.HasIndex("MessageId", "SenderId")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_chat_read_receipts_message_id_sender_id");
|
||||
|
||||
b.ToTable("chat_read_receipts", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@ -2909,27 +2879,6 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
b.Navigation("Sender");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReadReceipt", b =>
|
||||
{
|
||||
b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message")
|
||||
.WithMany("Statuses")
|
||||
.HasForeignKey("MessageId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_chat_read_receipts_chat_messages_message_id");
|
||||
|
||||
b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender")
|
||||
.WithMany()
|
||||
.HasForeignKey("SenderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_chat_read_receipts_chat_members_sender_id");
|
||||
|
||||
b.Navigation("Message");
|
||||
|
||||
b.Navigation("Sender");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b =>
|
||||
{
|
||||
b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room")
|
||||
@ -3400,8 +3349,6 @@ namespace DysonNetwork.Sphere.Migrations
|
||||
b.Navigation("Attachments");
|
||||
|
||||
b.Navigation("Reactions");
|
||||
|
||||
b.Navigation("Statuses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b =>
|
||||
|
Loading…
x
Reference in New Issue
Block a user