mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 19:54:55 +00:00
rework and starts for new friends system
This commit is contained in:
+145
-29
@@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
namespace Govor.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(GovorDbContext))]
|
||||
[Migration("20250630111826_InitialCreate")]
|
||||
[Migration("20250707142430_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
@@ -20,7 +20,7 @@ namespace Govor.Data.Migrations
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.6")
|
||||
.HasAnnotation("ProductVersion", "8.0.6")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
||||
@@ -41,13 +41,13 @@ namespace Govor.Data.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.PrimitiveCollection<string>("Admins")
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("varchar(500)");
|
||||
|
||||
b.PrimitiveCollection<string>("InviteCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
b.Property<Guid>("ImageId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<bool>("IsChannel")
|
||||
.HasColumnType("tinyint(1)");
|
||||
@@ -57,7 +57,8 @@ namespace Govor.Data.Migrations
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
@@ -102,9 +103,51 @@ namespace Govor.Data.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.ToTable("GroupAdmins");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Core.Models.GroupInvitation", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("varchar(500)");
|
||||
|
||||
b.Property<DateTime>("EndDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<Guid>("GroupId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("InvitationCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("MaxParticipants")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<Guid>("UserMakerId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.HasIndex("UserMakerId");
|
||||
|
||||
b.ToTable("GroupInvitations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Core.Models.GroupMembership", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@@ -114,6 +157,10 @@ namespace Govor.Data.Migrations
|
||||
b.Property<Guid>("GroupId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("InvitationId")
|
||||
.IsRequired()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<bool>("IsBanned")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
@@ -122,6 +169,10 @@ namespace Govor.Data.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.HasIndex("InvitationId");
|
||||
|
||||
b.ToTable("GroupMemberships");
|
||||
});
|
||||
|
||||
@@ -165,30 +216,46 @@ namespace Govor.Data.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("EncryptedKey")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("varchar(512)");
|
||||
|
||||
b.Property<string>("FilePath")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
b.Property<Guid>("MediaFileId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid>("MessageId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("MimeType")
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MediaFileId");
|
||||
|
||||
b.HasIndex("MessageId");
|
||||
|
||||
b.ToTable("MediaAttachments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Core.Models.MediaFile", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTime>("DateCreated")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("MediaType")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Type")
|
||||
b.Property<string>("MineType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("varchar(128)");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MessageId");
|
||||
|
||||
b.ToTable("MediaAttachments");
|
||||
b.ToTable("MediaFiles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Core.Models.Message", b =>
|
||||
@@ -229,8 +296,6 @@ namespace Govor.Data.Migrations
|
||||
|
||||
b.HasIndex("PrivateChatId");
|
||||
|
||||
b.HasIndex("ReplyToMessageId");
|
||||
|
||||
b.ToTable("Messages");
|
||||
});
|
||||
|
||||
@@ -371,14 +436,63 @@ namespace Govor.Data.Migrations
|
||||
b.Navigation("Requester");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Core.Models.GroupAdmins", b =>
|
||||
{
|
||||
b.HasOne("Govor.Core.Models.ChatGroup", null)
|
||||
.WithMany("Admins")
|
||||
.HasForeignKey("GroupId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Core.Models.GroupInvitation", b =>
|
||||
{
|
||||
b.HasOne("Govor.Core.Models.ChatGroup", null)
|
||||
.WithMany("InviteCodes")
|
||||
.HasForeignKey("GroupId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Govor.Core.Models.User", "UserMaker")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserMakerId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("UserMaker");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Core.Models.GroupMembership", b =>
|
||||
{
|
||||
b.HasOne("Govor.Core.Models.ChatGroup", null)
|
||||
.WithMany("Members")
|
||||
.HasForeignKey("GroupId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Govor.Core.Models.GroupInvitation", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("InvitationId")
|
||||
.OnDelete(DeleteBehavior.SetNull)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Core.Models.MediaAttachments", b =>
|
||||
{
|
||||
b.HasOne("Govor.Core.Models.MediaFile", "MediaFile")
|
||||
.WithMany()
|
||||
.HasForeignKey("MediaFileId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Govor.Core.Models.Message", "Message")
|
||||
.WithMany("MediaAttachments")
|
||||
.HasForeignKey("MessageId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("MediaFile");
|
||||
|
||||
b.Navigation("Message");
|
||||
});
|
||||
|
||||
@@ -387,13 +501,6 @@ namespace Govor.Data.Migrations
|
||||
b.HasOne("Govor.Core.Models.PrivateChat", null)
|
||||
.WithMany("Messages")
|
||||
.HasForeignKey("PrivateChatId");
|
||||
|
||||
b.HasOne("Govor.Core.Models.Message", "ReplyToMessage")
|
||||
.WithMany()
|
||||
.HasForeignKey("ReplyToMessageId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("ReplyToMessage");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Core.Models.MessageReaction", b =>
|
||||
@@ -435,6 +542,15 @@ namespace Govor.Data.Migrations
|
||||
b.Navigation("Invite");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Core.Models.ChatGroup", b =>
|
||||
{
|
||||
b.Navigation("Admins");
|
||||
|
||||
b.Navigation("InviteCodes");
|
||||
|
||||
b.Navigation("Members");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Core.Models.Invitation", b =>
|
||||
{
|
||||
b.Navigation("Users");
|
||||
+152
-58
@@ -19,14 +19,13 @@ namespace Govor.Data.Migrations
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
Name = table.Column<string>(type: "longtext", nullable: false)
|
||||
Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
InviteCode = table.Column<string>(type: "longtext", nullable: false)
|
||||
Description = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ImageId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
IsChannel = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
IsPrivate = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
Admins = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
IsPrivate = table.Column<bool>(type: "tinyint(1)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
@@ -34,35 +33,6 @@ namespace Govor.Data.Migrations
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "GroupAdmins",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
GroupId = 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")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_GroupAdmins", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "GroupMemberships",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
GroupId = 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"),
|
||||
IsBanned = table.Column<bool>(type: "tinyint(1)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_GroupMemberships", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Invitations",
|
||||
columns: table => new
|
||||
@@ -84,6 +54,25 @@ namespace Govor.Data.Migrations
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MediaFiles",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
Url = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
MediaType = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
MineType = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
DateCreated = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MediaFiles", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PrivateChats",
|
||||
columns: table => new
|
||||
@@ -98,6 +87,26 @@ namespace Govor.Data.Migrations
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "GroupAdmins",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
GroupId = 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")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_GroupAdmins", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_GroupAdmins_ChatGroups_GroupId",
|
||||
column: x => x.GroupId,
|
||||
principalTable: "ChatGroups",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Users",
|
||||
columns: table => new
|
||||
@@ -145,12 +154,6 @@ namespace Govor.Data.Migrations
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Messages", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Messages_Messages_ReplyToMessageId",
|
||||
column: x => x.ReplyToMessageId,
|
||||
principalTable: "Messages",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_Messages_PrivateChats_PrivateChatId",
|
||||
column: x => x.PrivateChatId,
|
||||
@@ -204,24 +207,56 @@ namespace Govor.Data.Migrations
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "GroupInvitations",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
GroupId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
UserMakerId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
InvitationCode = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Description = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
EndDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
MaxParticipants = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_GroupInvitations", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_GroupInvitations_ChatGroups_GroupId",
|
||||
column: x => x.GroupId,
|
||||
principalTable: "ChatGroups",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_GroupInvitations_Users_UserMakerId",
|
||||
column: x => x.UserMakerId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MediaAttachments",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
MessageId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
Type = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
FilePath = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
MimeType = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
EncryptedKey = table.Column<string>(type: "varchar(512)", maxLength: 512, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
MediaFileId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MediaAttachments", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_MediaAttachments_MediaFiles_MediaFileId",
|
||||
column: x => x.MediaFileId,
|
||||
principalTable: "MediaFiles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_MediaAttachments_Messages_MessageId",
|
||||
column: x => x.MessageId,
|
||||
@@ -281,6 +316,34 @@ namespace Govor.Data.Migrations
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "GroupMemberships",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
GroupId = 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"),
|
||||
InvitationId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||
IsBanned = table.Column<bool>(type: "tinyint(1)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_GroupMemberships", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_GroupMemberships_ChatGroups_GroupId",
|
||||
column: x => x.GroupId,
|
||||
principalTable: "ChatGroups",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_GroupMemberships_GroupInvitations_InvitationId",
|
||||
column: x => x.InvitationId,
|
||||
principalTable: "GroupInvitations",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Friendships_AddresseeId",
|
||||
table: "Friendships",
|
||||
@@ -291,6 +354,36 @@ namespace Govor.Data.Migrations
|
||||
table: "Friendships",
|
||||
column: "RequesterId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GroupAdmins_GroupId",
|
||||
table: "GroupAdmins",
|
||||
column: "GroupId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GroupInvitations_GroupId",
|
||||
table: "GroupInvitations",
|
||||
column: "GroupId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GroupInvitations_UserMakerId",
|
||||
table: "GroupInvitations",
|
||||
column: "UserMakerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GroupMemberships_GroupId",
|
||||
table: "GroupMemberships",
|
||||
column: "GroupId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GroupMemberships_InvitationId",
|
||||
table: "GroupMemberships",
|
||||
column: "InvitationId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MediaAttachments_MediaFileId",
|
||||
table: "MediaAttachments",
|
||||
column: "MediaFileId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MediaAttachments_MessageId",
|
||||
table: "MediaAttachments",
|
||||
@@ -312,11 +405,6 @@ namespace Govor.Data.Migrations
|
||||
table: "Messages",
|
||||
column: "PrivateChatId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Messages_ReplyToMessageId",
|
||||
table: "Messages",
|
||||
column: "ReplyToMessageId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MessageViews_MessageId_UserId",
|
||||
table: "MessageViews",
|
||||
@@ -335,9 +423,6 @@ namespace Govor.Data.Migrations
|
||||
migrationBuilder.DropTable(
|
||||
name: "Admins");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ChatGroups");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Friendships");
|
||||
|
||||
@@ -357,16 +442,25 @@ namespace Govor.Data.Migrations
|
||||
name: "MessageViews");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Users");
|
||||
name: "GroupInvitations");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MediaFiles");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Messages");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Invitations");
|
||||
name: "ChatGroups");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Users");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PrivateChats");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Invitations");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ namespace Govor.Data.Migrations
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.6")
|
||||
.HasAnnotation("ProductVersion", "8.0.6")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
||||
@@ -38,13 +38,13 @@ namespace Govor.Data.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.PrimitiveCollection<string>("Admins")
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("varchar(500)");
|
||||
|
||||
b.PrimitiveCollection<string>("InviteCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
b.Property<Guid>("ImageId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<bool>("IsChannel")
|
||||
.HasColumnType("tinyint(1)");
|
||||
@@ -54,7 +54,8 @@ namespace Govor.Data.Migrations
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
@@ -99,9 +100,51 @@ namespace Govor.Data.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.ToTable("GroupAdmins");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Core.Models.GroupInvitation", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("varchar(500)");
|
||||
|
||||
b.Property<DateTime>("EndDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<Guid>("GroupId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("InvitationCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("MaxParticipants")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<Guid>("UserMakerId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.HasIndex("UserMakerId");
|
||||
|
||||
b.ToTable("GroupInvitations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Core.Models.GroupMembership", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@@ -111,6 +154,10 @@ namespace Govor.Data.Migrations
|
||||
b.Property<Guid>("GroupId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("InvitationId")
|
||||
.IsRequired()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<bool>("IsBanned")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
@@ -119,6 +166,10 @@ namespace Govor.Data.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.HasIndex("InvitationId");
|
||||
|
||||
b.ToTable("GroupMemberships");
|
||||
});
|
||||
|
||||
@@ -162,30 +213,46 @@ namespace Govor.Data.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("EncryptedKey")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("varchar(512)");
|
||||
|
||||
b.Property<string>("FilePath")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
b.Property<Guid>("MediaFileId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid>("MessageId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("MimeType")
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MediaFileId");
|
||||
|
||||
b.HasIndex("MessageId");
|
||||
|
||||
b.ToTable("MediaAttachments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Core.Models.MediaFile", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTime>("DateCreated")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("MediaType")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Type")
|
||||
b.Property<string>("MineType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("varchar(128)");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MessageId");
|
||||
|
||||
b.ToTable("MediaAttachments");
|
||||
b.ToTable("MediaFiles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Core.Models.Message", b =>
|
||||
@@ -226,8 +293,6 @@ namespace Govor.Data.Migrations
|
||||
|
||||
b.HasIndex("PrivateChatId");
|
||||
|
||||
b.HasIndex("ReplyToMessageId");
|
||||
|
||||
b.ToTable("Messages");
|
||||
});
|
||||
|
||||
@@ -368,14 +433,63 @@ namespace Govor.Data.Migrations
|
||||
b.Navigation("Requester");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Core.Models.GroupAdmins", b =>
|
||||
{
|
||||
b.HasOne("Govor.Core.Models.ChatGroup", null)
|
||||
.WithMany("Admins")
|
||||
.HasForeignKey("GroupId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Core.Models.GroupInvitation", b =>
|
||||
{
|
||||
b.HasOne("Govor.Core.Models.ChatGroup", null)
|
||||
.WithMany("InviteCodes")
|
||||
.HasForeignKey("GroupId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Govor.Core.Models.User", "UserMaker")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserMakerId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("UserMaker");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Core.Models.GroupMembership", b =>
|
||||
{
|
||||
b.HasOne("Govor.Core.Models.ChatGroup", null)
|
||||
.WithMany("Members")
|
||||
.HasForeignKey("GroupId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Govor.Core.Models.GroupInvitation", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("InvitationId")
|
||||
.OnDelete(DeleteBehavior.SetNull)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Core.Models.MediaAttachments", b =>
|
||||
{
|
||||
b.HasOne("Govor.Core.Models.MediaFile", "MediaFile")
|
||||
.WithMany()
|
||||
.HasForeignKey("MediaFileId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Govor.Core.Models.Message", "Message")
|
||||
.WithMany("MediaAttachments")
|
||||
.HasForeignKey("MessageId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("MediaFile");
|
||||
|
||||
b.Navigation("Message");
|
||||
});
|
||||
|
||||
@@ -384,13 +498,6 @@ namespace Govor.Data.Migrations
|
||||
b.HasOne("Govor.Core.Models.PrivateChat", null)
|
||||
.WithMany("Messages")
|
||||
.HasForeignKey("PrivateChatId");
|
||||
|
||||
b.HasOne("Govor.Core.Models.Message", "ReplyToMessage")
|
||||
.WithMany()
|
||||
.HasForeignKey("ReplyToMessageId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("ReplyToMessage");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Core.Models.MessageReaction", b =>
|
||||
@@ -432,6 +539,15 @@ namespace Govor.Data.Migrations
|
||||
b.Navigation("Invite");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Core.Models.ChatGroup", b =>
|
||||
{
|
||||
b.Navigation("Admins");
|
||||
|
||||
b.Navigation("InviteCodes");
|
||||
|
||||
b.Navigation("Members");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Govor.Core.Models.Invitation", b =>
|
||||
{
|
||||
b.Navigation("Users");
|
||||
|
||||
Reference in New Issue
Block a user