1、优化消息排序逻辑 2、新增加载历史消息 3、修复已知问题 后端: 1、优化消息排序逻辑 2、增加用户信息缓存机制 3、修改日期类型为DateTimeOffset改善时区信息丢失问题 3、修复了已知问题 数据库: 1、新增SequenceId字段用于消息排序 2、新增ClientMsgId字段用于客户端消息回执
94 lines
3.0 KiB
C#
94 lines
3.0 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace IM_API.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class updatemessage : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "conversations_ibfk_2",
|
|
table: "conversations");
|
|
|
|
migrationBuilder.RenameIndex(
|
|
name: "lastMessageId",
|
|
table: "conversations",
|
|
newName: "LastReadSequenceId");
|
|
|
|
migrationBuilder.AddColumn<Guid>(
|
|
name: "ClientMsgId",
|
|
table: "messages",
|
|
type: "char(36)",
|
|
nullable: false,
|
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
|
collation: "ascii_general_ci");
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "MessageId",
|
|
table: "conversations",
|
|
type: "int(11)",
|
|
nullable: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_messages_SequenceId_StreamKey",
|
|
table: "messages",
|
|
columns: new[] { "SequenceId", "StreamKey" },
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_conversations_MessageId",
|
|
table: "conversations",
|
|
column: "MessageId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_conversations_messages_MessageId",
|
|
table: "conversations",
|
|
column: "MessageId",
|
|
principalTable: "messages",
|
|
principalColumn: "ID");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_conversations_messages_MessageId",
|
|
table: "conversations");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_messages_SequenceId_StreamKey",
|
|
table: "messages");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_conversations_MessageId",
|
|
table: "conversations");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "ClientMsgId",
|
|
table: "messages");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "MessageId",
|
|
table: "conversations");
|
|
|
|
migrationBuilder.RenameIndex(
|
|
name: "LastReadSequenceId",
|
|
table: "conversations",
|
|
newName: "lastMessageId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "conversations_ibfk_2",
|
|
table: "conversations",
|
|
column: "lastReadMessageId",
|
|
principalTable: "messages",
|
|
principalColumn: "ID",
|
|
onDelete: ReferentialAction.SetNull);
|
|
}
|
|
}
|
|
}
|