添加项目文件。
This commit is contained in:
+187
@@ -0,0 +1,187 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MessageService.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MessageService.Infrastructure.Migrations
|
||||
{
|
||||
[DbContext(typeof(MessageDbContext))]
|
||||
[Migration("20260423115234_InitMessageDb")]
|
||||
partial class InitMessageDb
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("MessageService.Domain.Entities.Conversation", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<int>("ChatType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTimeOffset>("CreationTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTimeOffset?>("Deletion")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("LastMessage")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<long?>("LastReadSequenceId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset?>("ModificationTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("StreamKey")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("TargetAvatar")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<Guid>("TargetId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("TargetName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("UnreadCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("conversations", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MessageService.Domain.Entities.Message", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<int>("ChatType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<Guid>("ClientMsgId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTimeOffset>("CreationTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTimeOffset?>("Deletion")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTimeOffset?>("ModificationTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("MsgType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<Guid>("SenderId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<long>("SequenceId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("State")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("StreamKey")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<Guid>("TargetId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.ComplexProperty<Dictionary<string, object>>("Content", "MessageService.Domain.Entities.Message.Content#MessageContent", b1 =>
|
||||
{
|
||||
b1.IsRequired();
|
||||
|
||||
b1.Property<string>("Fallback")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("varchar(255)")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "fallback");
|
||||
|
||||
b1.Property<string>("RawBody")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasColumnName("Content_Body");
|
||||
|
||||
b1.Property<string>("RawExt")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasColumnName("Content_Ext");
|
||||
|
||||
b1.ComplexProperty<Dictionary<string, object>>("Quote", "MessageService.Domain.Entities.Message.Content#MessageContent.Quote#QuoteInfo", b2 =>
|
||||
{
|
||||
b2.IsRequired();
|
||||
|
||||
b2.Property<Guid>("MessageId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnName("Quote_MsgId");
|
||||
|
||||
b2.Property<int>("MessageType")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("Quote_MsgType");
|
||||
|
||||
b2.Property<string>("Preview")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)")
|
||||
.HasColumnName("Quote_Preview");
|
||||
|
||||
b2.Property<Guid>("SenderId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnName("Quote_SenderId");
|
||||
|
||||
b2.Property<string>("SenderName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("Quote_SenderName");
|
||||
});
|
||||
});
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("StreamKey", "SequenceId");
|
||||
|
||||
b.ToTable("messages", (string)null);
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MessageService.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitMessageDb : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterDatabase()
|
||||
.Annotation("MySql:Charset", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "conversations",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
UserId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
TargetId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
TargetAvatar = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:Charset", "utf8mb4"),
|
||||
TargetName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:Charset", "utf8mb4"),
|
||||
LastReadSequenceId = table.Column<long>(type: "bigint", nullable: true),
|
||||
UnreadCount = table.Column<int>(type: "int", nullable: false),
|
||||
ChatType = table.Column<int>(type: "int", nullable: false),
|
||||
StreamKey = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:Charset", "utf8mb4"),
|
||||
LastMessage = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:Charset", "utf8mb4"),
|
||||
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
CreationTime = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: false),
|
||||
Deletion = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: true),
|
||||
ModificationTime = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_conversations", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:Charset", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "messages",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
ChatType = table.Column<int>(type: "int", nullable: false),
|
||||
MsgType = table.Column<int>(type: "int", nullable: false),
|
||||
ClientMsgId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
SenderId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
TargetId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
State = table.Column<int>(type: "int", nullable: false),
|
||||
StreamKey = table.Column<string>(type: "varchar(255)", nullable: false)
|
||||
.Annotation("MySql:Charset", "utf8mb4"),
|
||||
SequenceId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Content_Fallback = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: false),
|
||||
Content_Body = table.Column<string>(type: "longtext", nullable: false),
|
||||
Content_Ext = table.Column<string>(type: "longtext", nullable: false),
|
||||
Quote_MsgId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
Quote_MsgType = table.Column<int>(type: "int", nullable: false),
|
||||
Quote_Preview = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false),
|
||||
Quote_SenderId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
Quote_SenderName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false),
|
||||
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
CreationTime = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: false),
|
||||
Deletion = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: true),
|
||||
ModificationTime = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_messages", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:Charset", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_conversations_UserId",
|
||||
table: "conversations",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_messages_StreamKey_SequenceId",
|
||||
table: "messages",
|
||||
columns: new[] { "StreamKey", "SequenceId" });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "conversations");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "messages");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MessageService.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MessageService.Infrastructure.Migrations
|
||||
{
|
||||
[DbContext(typeof(MessageDbContext))]
|
||||
partial class MessageDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("MessageService.Domain.Entities.Conversation", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<int>("ChatType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTimeOffset>("CreationTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTimeOffset?>("Deletion")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("LastMessage")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<long?>("LastReadSequenceId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset?>("ModificationTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("StreamKey")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("TargetAvatar")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<Guid>("TargetId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("TargetName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("UnreadCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("conversations", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MessageService.Domain.Entities.Message", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<int>("ChatType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<Guid>("ClientMsgId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTimeOffset>("CreationTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTimeOffset?>("Deletion")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTimeOffset?>("ModificationTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("MsgType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<Guid>("SenderId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<long>("SequenceId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("State")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("StreamKey")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<Guid>("TargetId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.ComplexProperty<Dictionary<string, object>>("Content", "MessageService.Domain.Entities.Message.Content#MessageContent", b1 =>
|
||||
{
|
||||
b1.IsRequired();
|
||||
|
||||
b1.Property<string>("Fallback")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("varchar(255)")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "fallback");
|
||||
|
||||
b1.Property<string>("RawBody")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasColumnName("Content_Body");
|
||||
|
||||
b1.Property<string>("RawExt")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasColumnName("Content_Ext");
|
||||
|
||||
b1.ComplexProperty<Dictionary<string, object>>("Quote", "MessageService.Domain.Entities.Message.Content#MessageContent.Quote#QuoteInfo", b2 =>
|
||||
{
|
||||
b2.IsRequired();
|
||||
|
||||
b2.Property<Guid>("MessageId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnName("Quote_MsgId");
|
||||
|
||||
b2.Property<int>("MessageType")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("Quote_MsgType");
|
||||
|
||||
b2.Property<string>("Preview")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)")
|
||||
.HasColumnName("Quote_Preview");
|
||||
|
||||
b2.Property<Guid>("SenderId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnName("Quote_SenderId");
|
||||
|
||||
b2.Property<string>("SenderName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasColumnName("Quote_SenderName");
|
||||
});
|
||||
});
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("StreamKey", "SequenceId");
|
||||
|
||||
b.ToTable("messages", (string)null);
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user