mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 19:54:55 +00:00
MySQL migration
This commit is contained in:
@@ -105,8 +105,6 @@ public class FriendsControllerTests
|
|||||||
Assert.That(objectResult.StatusCode, Is.EqualTo(500));
|
Assert.That(objectResult.StatusCode, Is.EqualTo(500));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[TearDown]
|
[TearDown]
|
||||||
public void TearDown()
|
public void TearDown()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using Govor.Application.Validators; // или другой namespace
|
|
||||||
using Govor.Application.Exceptions.AuthService;
|
using Govor.Application.Exceptions.AuthService;
|
||||||
|
using Govor.Application.Infrastructure.Validators;
|
||||||
|
|
||||||
namespace Govor.API.Tests.UnitTests.Services.Validators;
|
namespace Govor.API.Tests.UnitTests.Services.Validators;
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace Govor.API.Controllers.AdminStuff;
|
|||||||
|
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Authorize(Roles = "Admin")]
|
//[Authorize(Roles = "Admin")]
|
||||||
public class InviteUserController : Controller
|
public class InviteUserController : Controller
|
||||||
{
|
{
|
||||||
private readonly IInvitesRepository _repository;
|
private readonly IInvitesRepository _repository;
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
using Govor.API.Services.AdminsStuff.Interfaces;
|
using Govor.API.Services.AdminsStuff.Interfaces;
|
||||||
using Govor.API.Services.Authentication.Interfaces;
|
using Govor.API.Services.Authentication.Interfaces;
|
||||||
using Govor.Application.Infrastructure.Extensions;
|
using Govor.Application.Infrastructure.Extensions;
|
||||||
|
using Govor.Application.Infrastructure.Validators;
|
||||||
using Govor.Application.Interfaces;
|
using Govor.Application.Interfaces;
|
||||||
using Govor.Application.Interfaces.AdminsStuff;
|
using Govor.Application.Interfaces.AdminsStuff;
|
||||||
using Govor.Application.Interfaces.Authentication;
|
using Govor.Application.Interfaces.Authentication;
|
||||||
using Govor.Application.Interfaces.Infrastructure.Extensions;
|
using Govor.Application.Interfaces.Infrastructure.Extensions;
|
||||||
using Govor.Application.Services;
|
using Govor.Application.Services;
|
||||||
using Govor.Application.Validators;
|
|
||||||
using Govor.Core.Infrastructure.Extensions;
|
using Govor.Core.Infrastructure.Extensions;
|
||||||
using Govor.Core.Infrastructure.Validators;
|
using Govor.Core.Infrastructure.Validators;
|
||||||
using Govor.Core.Models;
|
using Govor.Core.Models;
|
||||||
@@ -67,11 +67,19 @@ public static class ConfigurationProgramExtensions
|
|||||||
|
|
||||||
public static void AddGovorDbContext(this IServiceCollection services, IConfiguration configuration)
|
public static void AddGovorDbContext(this IServiceCollection services, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
services.AddDbContext<GovorDbContext>(
|
var useMySql = configuration.GetValue<bool>("UseMySql"); // Получаем значение из конфигурации
|
||||||
options =>
|
|
||||||
|
if (useMySql)
|
||||||
{
|
{
|
||||||
options.UseNpgsql(configuration.GetConnectionString(nameof(GovorDbContext)));
|
services.AddDbContext<GovorDbContext>(options =>
|
||||||
|
options.UseMySql(configuration.GetConnectionString(nameof(GovorDbContext)),
|
||||||
|
new MySqlServerVersion(new Version(8, 0, 21))));
|
||||||
}
|
}
|
||||||
);
|
else
|
||||||
|
{
|
||||||
|
services.AddDbContext<GovorDbContext>(options =>
|
||||||
|
options.UseNpgsql(configuration.GetConnectionString(nameof(GovorDbContext))));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
|
||||||
<PackageReference Include="NSwag.AspNetCore" Version="14.4.0" />
|
<PackageReference Include="NSwag.AspNetCore" Version="14.4.0" />
|
||||||
|
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="9.0.0-preview.3.efcore.9.0.0" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="9.0.1" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="9.0.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"GovorDbContext": "Host=localhost;Port=5432;Database=DbGovor;Username=postgres;Password=stalcker;"
|
"GovorDbContext": "Server=147.45.255.215;Port=3306;Database=artemy_DB;User=artemy;Password=LoxHuy))228Goy;"
|
||||||
},
|
},
|
||||||
|
"UseMySql": true,
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
"JwtOption": {
|
"JwtOption": {
|
||||||
"SecretKeу": "MY VERY SECRET KEY asdasdpafjhasofafpajsfj",
|
"SecretKeу": "MY VERY SECRET KEY asdasdpafjhasofafpajsfj",
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using Govor.Application.Exceptions.AuthService;
|
|||||||
using Govor.Application.Interfaces.Authentication;
|
using Govor.Application.Interfaces.Authentication;
|
||||||
using Govor.Core.Infrastructure.Validators;
|
using Govor.Core.Infrastructure.Validators;
|
||||||
|
|
||||||
namespace Govor.Application.Validators;
|
namespace Govor.Application.Infrastructure.Validators;
|
||||||
|
|
||||||
public class UsernameValidator : IUsernameValidator
|
public class UsernameValidator : IUsernameValidator
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.6" />
|
||||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
|
||||||
|
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="9.0.0-preview.3.efcore.9.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,383 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Govor.Data;
|
|
||||||
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.Data.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(GovorDbContext))]
|
|
||||||
[Migration("20250624133431_InitialCreate")]
|
|
||||||
partial class InitialCreate
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "9.0.6")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
|
||||||
|
|
||||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.Admin", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("UserId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.HasKey("UserId");
|
|
||||||
|
|
||||||
b.ToTable("Admins");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.ChatGroup", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.PrimitiveCollection<List<Guid>>("Admins")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("uuid[]");
|
|
||||||
|
|
||||||
b.PrimitiveCollection<List<string>>("InviteCode")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text[]");
|
|
||||||
|
|
||||||
b.Property<bool>("IsChannel")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<bool>("IsPrivate")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("ChatGroups");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.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.ToTable("GroupAdmins");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.GroupMembership", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<Guid>("GroupId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<bool>("IsBanned")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<Guid>("UserId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("GroupMemberships");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.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>("IsAdmin")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<int>("MaxParticipants")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Invitations");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.MediaAttachments", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<string>("EncryptedKey")
|
|
||||||
.HasMaxLength(512)
|
|
||||||
.HasColumnType("character varying(512)");
|
|
||||||
|
|
||||||
b.Property<string>("FilePath")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<Guid>("MessageId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<string>("MimeType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Type")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("MessageId");
|
|
||||||
|
|
||||||
b.ToTable("MediaAttachments");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.Message", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.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>("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("ReplyToMessageId");
|
|
||||||
|
|
||||||
b.ToTable("Messages");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.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.Core.Models.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.Core.Models.User", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<DateOnly>("CreatedOn")
|
|
||||||
.HasColumnType("date");
|
|
||||||
|
|
||||||
b.Property<string>("Description")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<Guid>("IconId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<Guid>("InviteId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<string>("PasswordHash")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Username")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<DateTime>("WasOnline")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("InviteId");
|
|
||||||
|
|
||||||
b.ToTable("Users");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.Admin", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Govor.Core.Models.User", "User")
|
|
||||||
.WithOne()
|
|
||||||
.HasForeignKey("Govor.Core.Models.Admin", "UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("User");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.MediaAttachments", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Govor.Core.Models.Message", "Message")
|
|
||||||
.WithMany("MediaAttachments")
|
|
||||||
.HasForeignKey("MessageId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Message");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.Message", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Govor.Core.Models.Message", "ReplyToMessage")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ReplyToMessageId")
|
|
||||||
.OnDelete(DeleteBehavior.Restrict);
|
|
||||||
|
|
||||||
b.Navigation("ReplyToMessage");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.MessageReaction", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Govor.Core.Models.Message", "Message")
|
|
||||||
.WithMany("Reactions")
|
|
||||||
.HasForeignKey("MessageId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("Govor.Core.Models.User", "User")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Message");
|
|
||||||
|
|
||||||
b.Navigation("User");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.MessageView", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Govor.Core.Models.Message", null)
|
|
||||||
.WithMany("MessageViews")
|
|
||||||
.HasForeignKey("MessageId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.User", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Govor.Core.Models.Invitation", "Invite")
|
|
||||||
.WithMany("Users")
|
|
||||||
.HasForeignKey("InviteId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Invite");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.Invitation", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Users");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.Message", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("MediaAttachments");
|
|
||||||
|
|
||||||
b.Navigation("MessageViews");
|
|
||||||
|
|
||||||
b.Navigation("Reactions");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,277 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Govor.Data.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class InitialCreate : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "ChatGroups",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
Name = table.Column<string>(type: "text", nullable: false),
|
|
||||||
InviteCode = table.Column<List<string>>(type: "text[]", nullable: false),
|
|
||||||
IsChannel = table.Column<bool>(type: "boolean", nullable: false),
|
|
||||||
IsPrivate = table.Column<bool>(type: "boolean", nullable: false),
|
|
||||||
Admins = table.Column<List<Guid>>(type: "uuid[]", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_ChatGroups", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "GroupAdmins",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
GroupId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
UserId = table.Column<Guid>(type: "uuid", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_GroupAdmins", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "GroupMemberships",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
GroupId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
IsBanned = table.Column<bool>(type: "boolean", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_GroupMemberships", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Invitations",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
IsAdmin = table.Column<bool>(type: "boolean", nullable: false),
|
|
||||||
Code = table.Column<string>(type: "text", nullable: false),
|
|
||||||
Description = table.Column<string>(type: "text", nullable: false),
|
|
||||||
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
||||||
EndDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
||||||
MaxParticipants = table.Column<int>(type: "integer", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Invitations", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Messages",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
SenderId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
RecipientId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
RecipientType = table.Column<int>(type: "integer", nullable: false),
|
|
||||||
EncryptedContent = table.Column<string>(type: "text", nullable: false),
|
|
||||||
SentAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
||||||
IsEdited = table.Column<bool>(type: "boolean", nullable: false),
|
|
||||||
EditedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
|
||||||
ReplyToMessageId = table.Column<Guid>(type: "uuid", nullable: true)
|
|
||||||
},
|
|
||||||
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);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Users",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
Username = table.Column<string>(type: "text", nullable: false),
|
|
||||||
Description = table.Column<string>(type: "text", nullable: false),
|
|
||||||
PasswordHash = table.Column<string>(type: "text", nullable: false),
|
|
||||||
IconId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
CreatedOn = table.Column<DateOnly>(type: "date", nullable: false),
|
|
||||||
WasOnline = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
||||||
InviteId = table.Column<Guid>(type: "uuid", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Users", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Users_Invitations_InviteId",
|
|
||||||
column: x => x.InviteId,
|
|
||||||
principalTable: "Invitations",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "MediaAttachments",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
MessageId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
Type = table.Column<string>(type: "text", nullable: false),
|
|
||||||
FilePath = table.Column<string>(type: "text", nullable: false),
|
|
||||||
MimeType = table.Column<string>(type: "text", nullable: false),
|
|
||||||
EncryptedKey = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_MediaAttachments", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_MediaAttachments_Messages_MessageId",
|
|
||||||
column: x => x.MessageId,
|
|
||||||
principalTable: "Messages",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "MessageViews",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
MessageId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
ViewedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_MessageViews", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_MessageViews_Messages_MessageId",
|
|
||||||
column: x => x.MessageId,
|
|
||||||
principalTable: "Messages",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Admins",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
UserId = table.Column<Guid>(type: "uuid", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Admins", x => x.UserId);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Admins_Users_UserId",
|
|
||||||
column: x => x.UserId,
|
|
||||||
principalTable: "Users",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "MessageReactions",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
MessageId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
ReactionCode = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
|
||||||
ReactedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_MessageReactions", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_MessageReactions_Messages_MessageId",
|
|
||||||
column: x => x.MessageId,
|
|
||||||
principalTable: "Messages",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_MessageReactions_Users_UserId",
|
|
||||||
column: x => x.UserId,
|
|
||||||
principalTable: "Users",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_MediaAttachments_MessageId",
|
|
||||||
table: "MediaAttachments",
|
|
||||||
column: "MessageId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_MessageReactions_MessageId_UserId",
|
|
||||||
table: "MessageReactions",
|
|
||||||
columns: new[] { "MessageId", "UserId" },
|
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_MessageReactions_UserId",
|
|
||||||
table: "MessageReactions",
|
|
||||||
column: "UserId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Messages_ReplyToMessageId",
|
|
||||||
table: "Messages",
|
|
||||||
column: "ReplyToMessageId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_MessageViews_MessageId_UserId",
|
|
||||||
table: "MessageViews",
|
|
||||||
columns: new[] { "MessageId", "UserId" },
|
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Users_InviteId",
|
|
||||||
table: "Users",
|
|
||||||
column: "InviteId");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Admins");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "ChatGroups");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "GroupAdmins");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "GroupMemberships");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "MediaAttachments");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "MessageReactions");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "MessageViews");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Users");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Messages");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Invitations");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,386 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Govor.Data;
|
|
||||||
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.Data.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(GovorDbContext))]
|
|
||||||
[Migration("20250624141242_inviteAddIsActive")]
|
|
||||||
partial class inviteAddIsActive
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "9.0.6")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
|
||||||
|
|
||||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.Admin", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("UserId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.HasKey("UserId");
|
|
||||||
|
|
||||||
b.ToTable("Admins");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.ChatGroup", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.PrimitiveCollection<List<Guid>>("Admins")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("uuid[]");
|
|
||||||
|
|
||||||
b.PrimitiveCollection<List<string>>("InviteCode")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text[]");
|
|
||||||
|
|
||||||
b.Property<bool>("IsChannel")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<bool>("IsPrivate")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("ChatGroups");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.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.ToTable("GroupAdmins");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.GroupMembership", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<Guid>("GroupId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<bool>("IsBanned")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<Guid>("UserId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("GroupMemberships");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.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.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Invitations");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.MediaAttachments", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<string>("EncryptedKey")
|
|
||||||
.HasMaxLength(512)
|
|
||||||
.HasColumnType("character varying(512)");
|
|
||||||
|
|
||||||
b.Property<string>("FilePath")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<Guid>("MessageId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<string>("MimeType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Type")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("MessageId");
|
|
||||||
|
|
||||||
b.ToTable("MediaAttachments");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.Message", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.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>("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("ReplyToMessageId");
|
|
||||||
|
|
||||||
b.ToTable("Messages");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.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.Core.Models.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.Core.Models.User", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<DateOnly>("CreatedOn")
|
|
||||||
.HasColumnType("date");
|
|
||||||
|
|
||||||
b.Property<string>("Description")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<Guid>("IconId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<Guid>("InviteId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<string>("PasswordHash")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Username")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<DateTime>("WasOnline")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("InviteId");
|
|
||||||
|
|
||||||
b.ToTable("Users");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.Admin", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Govor.Core.Models.User", "User")
|
|
||||||
.WithOne()
|
|
||||||
.HasForeignKey("Govor.Core.Models.Admin", "UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("User");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.MediaAttachments", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Govor.Core.Models.Message", "Message")
|
|
||||||
.WithMany("MediaAttachments")
|
|
||||||
.HasForeignKey("MessageId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Message");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.Message", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Govor.Core.Models.Message", "ReplyToMessage")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ReplyToMessageId")
|
|
||||||
.OnDelete(DeleteBehavior.Restrict);
|
|
||||||
|
|
||||||
b.Navigation("ReplyToMessage");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.MessageReaction", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Govor.Core.Models.Message", "Message")
|
|
||||||
.WithMany("Reactions")
|
|
||||||
.HasForeignKey("MessageId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("Govor.Core.Models.User", "User")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Message");
|
|
||||||
|
|
||||||
b.Navigation("User");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.MessageView", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Govor.Core.Models.Message", null)
|
|
||||||
.WithMany("MessageViews")
|
|
||||||
.HasForeignKey("MessageId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.User", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Govor.Core.Models.Invitation", "Invite")
|
|
||||||
.WithMany("Users")
|
|
||||||
.HasForeignKey("InviteId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Invite");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.Invitation", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Users");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.Message", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("MediaAttachments");
|
|
||||||
|
|
||||||
b.Navigation("MessageViews");
|
|
||||||
|
|
||||||
b.Navigation("Reactions");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Govor.Data.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class inviteAddIsActive : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AddColumn<bool>(
|
|
||||||
name: "IsActive",
|
|
||||||
table: "Invitations",
|
|
||||||
type: "boolean",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "IsActive",
|
|
||||||
table: "Invitations");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,104 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Govor.Data.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class friendships : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AddColumn<Guid>(
|
|
||||||
name: "PrivateChatId",
|
|
||||||
table: "Messages",
|
|
||||||
type: "uuid",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Friendships",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
RequesterId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
AddresseeId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
Status = table.Column<int>(type: "integer", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Friendships", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Friendships_Users_AddresseeId",
|
|
||||||
column: x => x.AddresseeId,
|
|
||||||
principalTable: "Users",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Restrict);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Friendships_Users_RequesterId",
|
|
||||||
column: x => x.RequesterId,
|
|
||||||
principalTable: "Users",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Restrict);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "PrivateChats",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
UserAId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
UserBId = table.Column<Guid>(type: "uuid", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_PrivateChats", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Messages_PrivateChatId",
|
|
||||||
table: "Messages",
|
|
||||||
column: "PrivateChatId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Friendships_AddresseeId",
|
|
||||||
table: "Friendships",
|
|
||||||
column: "AddresseeId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Friendships_RequesterId",
|
|
||||||
table: "Friendships",
|
|
||||||
column: "RequesterId");
|
|
||||||
|
|
||||||
migrationBuilder.AddForeignKey(
|
|
||||||
name: "FK_Messages_PrivateChats_PrivateChatId",
|
|
||||||
table: "Messages",
|
|
||||||
column: "PrivateChatId",
|
|
||||||
principalTable: "PrivateChats",
|
|
||||||
principalColumn: "Id");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropForeignKey(
|
|
||||||
name: "FK_Messages_PrivateChats_PrivateChatId",
|
|
||||||
table: "Messages");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Friendships");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "PrivateChats");
|
|
||||||
|
|
||||||
migrationBuilder.DropIndex(
|
|
||||||
name: "IX_Messages_PrivateChatId",
|
|
||||||
table: "Messages");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "PrivateChatId",
|
|
||||||
table: "Messages");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+68
-69
@@ -1,20 +1,19 @@
|
|||||||
// <auto-generated />
|
// <auto-generated />
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using Govor.Data;
|
using Govor.Data;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace Govor.Data.Migrations
|
namespace Govor.Data.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(GovorDbContext))]
|
[DbContext(typeof(GovorDbContext))]
|
||||||
[Migration("20250627101322_friendships")]
|
[Migration("20250630111826_InitialCreate")]
|
||||||
partial class friendships
|
partial class InitialCreate
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@@ -22,14 +21,14 @@ namespace Govor.Data.Migrations
|
|||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("ProductVersion", "9.0.6")
|
.HasAnnotation("ProductVersion", "9.0.6")
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||||
|
|
||||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.Admin", b =>
|
modelBuilder.Entity("Govor.Core.Models.Admin", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("UserId")
|
b.Property<Guid>("UserId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.HasKey("UserId");
|
b.HasKey("UserId");
|
||||||
|
|
||||||
@@ -40,25 +39,25 @@ namespace Govor.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.PrimitiveCollection<List<Guid>>("Admins")
|
b.PrimitiveCollection<string>("Admins")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("uuid[]");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.PrimitiveCollection<List<string>>("InviteCode")
|
b.PrimitiveCollection<string>("InviteCode")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text[]");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.Property<bool>("IsChannel")
|
b.Property<bool>("IsChannel")
|
||||||
.HasColumnType("boolean");
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
b.Property<bool>("IsPrivate")
|
b.Property<bool>("IsPrivate")
|
||||||
.HasColumnType("boolean");
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -69,16 +68,16 @@ namespace Govor.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<Guid>("AddresseeId")
|
b.Property<Guid>("AddresseeId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<Guid>("RequesterId")
|
b.Property<Guid>("RequesterId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<int>("Status")
|
b.Property<int>("Status")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -93,13 +92,13 @@ namespace Govor.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<Guid>("GroupId")
|
b.Property<Guid>("GroupId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<Guid>("UserId")
|
b.Property<Guid>("UserId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -110,16 +109,16 @@ namespace Govor.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<Guid>("GroupId")
|
b.Property<Guid>("GroupId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<bool>("IsBanned")
|
b.Property<bool>("IsBanned")
|
||||||
.HasColumnType("boolean");
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
b.Property<Guid>("UserId")
|
b.Property<Guid>("UserId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -130,30 +129,30 @@ namespace Govor.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<string>("Code")
|
b.Property<string>("Code")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.Property<DateTime>("DateCreated")
|
b.Property<DateTime>("DateCreated")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
b.Property<string>("Description")
|
b.Property<string>("Description")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.Property<DateTime>("EndDate")
|
b.Property<DateTime>("EndDate")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
b.Property<bool>("IsActive")
|
b.Property<bool>("IsActive")
|
||||||
.HasColumnType("boolean");
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
b.Property<bool>("IsAdmin")
|
b.Property<bool>("IsAdmin")
|
||||||
.HasColumnType("boolean");
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
b.Property<int>("MaxParticipants")
|
b.Property<int>("MaxParticipants")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -164,26 +163,26 @@ namespace Govor.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<string>("EncryptedKey")
|
b.Property<string>("EncryptedKey")
|
||||||
.HasMaxLength(512)
|
.HasMaxLength(512)
|
||||||
.HasColumnType("character varying(512)");
|
.HasColumnType("varchar(512)");
|
||||||
|
|
||||||
b.Property<string>("FilePath")
|
b.Property<string>("FilePath")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.Property<Guid>("MessageId")
|
b.Property<Guid>("MessageId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<string>("MimeType")
|
b.Property<string>("MimeType")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.Property<string>("Type")
|
b.Property<string>("Type")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -196,35 +195,35 @@ namespace Govor.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<DateTime?>("EditedAt")
|
b.Property<DateTime?>("EditedAt")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
b.Property<string>("EncryptedContent")
|
b.Property<string>("EncryptedContent")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.Property<bool>("IsEdited")
|
b.Property<bool>("IsEdited")
|
||||||
.HasColumnType("boolean");
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
b.Property<Guid?>("PrivateChatId")
|
b.Property<Guid?>("PrivateChatId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<Guid>("RecipientId")
|
b.Property<Guid>("RecipientId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<int>("RecipientType")
|
b.Property<int>("RecipientType")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<Guid?>("ReplyToMessageId")
|
b.Property<Guid?>("ReplyToMessageId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<Guid>("SenderId")
|
b.Property<Guid>("SenderId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<DateTime>("SentAt")
|
b.Property<DateTime>("SentAt")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -239,21 +238,21 @@ namespace Govor.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<Guid>("MessageId")
|
b.Property<Guid>("MessageId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<DateTime>("ReactedAt")
|
b.Property<DateTime>("ReactedAt")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
b.Property<string>("ReactionCode")
|
b.Property<string>("ReactionCode")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(64)
|
.HasMaxLength(64)
|
||||||
.HasColumnType("character varying(64)");
|
.HasColumnType("varchar(64)");
|
||||||
|
|
||||||
b.Property<Guid>("UserId")
|
b.Property<Guid>("UserId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -269,16 +268,16 @@ namespace Govor.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<Guid>("MessageId")
|
b.Property<Guid>("MessageId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<Guid>("UserId")
|
b.Property<Guid>("UserId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<DateTime>("ViewedAt")
|
b.Property<DateTime>("ViewedAt")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -292,13 +291,13 @@ namespace Govor.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<Guid>("UserAId")
|
b.Property<Guid>("UserAId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<Guid>("UserBId")
|
b.Property<Guid>("UserBId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -309,31 +308,31 @@ namespace Govor.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<DateOnly>("CreatedOn")
|
b.Property<DateOnly>("CreatedOn")
|
||||||
.HasColumnType("date");
|
.HasColumnType("date");
|
||||||
|
|
||||||
b.Property<string>("Description")
|
b.Property<string>("Description")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.Property<Guid>("IconId")
|
b.Property<Guid>("IconId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<Guid>("InviteId")
|
b.Property<Guid>("InviteId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<string>("PasswordHash")
|
b.Property<string>("PasswordHash")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.Property<string>("Username")
|
b.Property<string>("Username")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.Property<DateTime>("WasOnline")
|
b.Property<DateTime>("WasOnline")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -0,0 +1,372 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Govor.Data.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class InitialCreate : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterDatabase()
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "ChatGroups",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||||
|
Name = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
InviteCode = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
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")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_ChatGroups", x => x.Id);
|
||||||
|
})
|
||||||
|
.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
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||||
|
IsAdmin = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||||
|
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||||
|
Code = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Description = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
DateCreated = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||||
|
EndDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||||
|
MaxParticipants = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Invitations", x => x.Id);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "PrivateChats",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||||
|
UserAId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||||
|
UserBId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_PrivateChats", x => x.Id);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Users",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||||
|
Username = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Description = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
PasswordHash = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
IconId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||||
|
CreatedOn = table.Column<DateOnly>(type: "date", nullable: false),
|
||||||
|
WasOnline = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||||
|
InviteId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Users", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Users_Invitations_InviteId",
|
||||||
|
column: x => x.InviteId,
|
||||||
|
principalTable: "Invitations",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Messages",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = 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"),
|
||||||
|
RecipientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||||
|
RecipientType = table.Column<int>(type: "int", nullable: false),
|
||||||
|
EncryptedContent = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
SentAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||||
|
IsEdited = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||||
|
EditedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||||
|
ReplyToMessageId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||||
|
PrivateChatId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci")
|
||||||
|
},
|
||||||
|
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,
|
||||||
|
principalTable: "PrivateChats",
|
||||||
|
principalColumn: "Id");
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Admins",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
UserId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Admins", x => x.UserId);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Admins_Users_UserId",
|
||||||
|
column: x => x.UserId,
|
||||||
|
principalTable: "Users",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Friendships",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||||
|
RequesterId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||||
|
AddresseeId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||||
|
Status = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Friendships", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Friendships_Users_AddresseeId",
|
||||||
|
column: x => x.AddresseeId,
|
||||||
|
principalTable: "Users",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Friendships_Users_RequesterId",
|
||||||
|
column: x => x.RequesterId,
|
||||||
|
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")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_MediaAttachments", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_MediaAttachments_Messages_MessageId",
|
||||||
|
column: x => x.MessageId,
|
||||||
|
principalTable: "Messages",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "MessageReactions",
|
||||||
|
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"),
|
||||||
|
UserId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||||
|
ReactionCode = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
ReactedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_MessageReactions", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_MessageReactions_Messages_MessageId",
|
||||||
|
column: x => x.MessageId,
|
||||||
|
principalTable: "Messages",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_MessageReactions_Users_UserId",
|
||||||
|
column: x => x.UserId,
|
||||||
|
principalTable: "Users",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "MessageViews",
|
||||||
|
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"),
|
||||||
|
UserId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||||
|
ViewedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_MessageViews", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_MessageViews_Messages_MessageId",
|
||||||
|
column: x => x.MessageId,
|
||||||
|
principalTable: "Messages",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Friendships_AddresseeId",
|
||||||
|
table: "Friendships",
|
||||||
|
column: "AddresseeId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Friendships_RequesterId",
|
||||||
|
table: "Friendships",
|
||||||
|
column: "RequesterId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_MediaAttachments_MessageId",
|
||||||
|
table: "MediaAttachments",
|
||||||
|
column: "MessageId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_MessageReactions_MessageId_UserId",
|
||||||
|
table: "MessageReactions",
|
||||||
|
columns: new[] { "MessageId", "UserId" },
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_MessageReactions_UserId",
|
||||||
|
table: "MessageReactions",
|
||||||
|
column: "UserId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Messages_PrivateChatId",
|
||||||
|
table: "Messages",
|
||||||
|
column: "PrivateChatId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Messages_ReplyToMessageId",
|
||||||
|
table: "Messages",
|
||||||
|
column: "ReplyToMessageId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_MessageViews_MessageId_UserId",
|
||||||
|
table: "MessageViews",
|
||||||
|
columns: new[] { "MessageId", "UserId" },
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Users_InviteId",
|
||||||
|
table: "Users",
|
||||||
|
column: "InviteId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Admins");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "ChatGroups");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Friendships");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "GroupAdmins");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "GroupMemberships");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "MediaAttachments");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "MessageReactions");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "MessageViews");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Users");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Messages");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Invitations");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "PrivateChats");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
// <auto-generated />
|
// <auto-generated />
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using Govor.Data;
|
using Govor.Data;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
@@ -19,14 +18,14 @@ namespace Govor.Data.Migrations
|
|||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("ProductVersion", "9.0.6")
|
.HasAnnotation("ProductVersion", "9.0.6")
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||||
|
|
||||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
||||||
|
|
||||||
modelBuilder.Entity("Govor.Core.Models.Admin", b =>
|
modelBuilder.Entity("Govor.Core.Models.Admin", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("UserId")
|
b.Property<Guid>("UserId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.HasKey("UserId");
|
b.HasKey("UserId");
|
||||||
|
|
||||||
@@ -37,25 +36,25 @@ namespace Govor.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.PrimitiveCollection<List<Guid>>("Admins")
|
b.PrimitiveCollection<string>("Admins")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("uuid[]");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.PrimitiveCollection<List<string>>("InviteCode")
|
b.PrimitiveCollection<string>("InviteCode")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text[]");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.Property<bool>("IsChannel")
|
b.Property<bool>("IsChannel")
|
||||||
.HasColumnType("boolean");
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
b.Property<bool>("IsPrivate")
|
b.Property<bool>("IsPrivate")
|
||||||
.HasColumnType("boolean");
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -66,16 +65,16 @@ namespace Govor.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<Guid>("AddresseeId")
|
b.Property<Guid>("AddresseeId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<Guid>("RequesterId")
|
b.Property<Guid>("RequesterId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<int>("Status")
|
b.Property<int>("Status")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -90,13 +89,13 @@ namespace Govor.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<Guid>("GroupId")
|
b.Property<Guid>("GroupId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<Guid>("UserId")
|
b.Property<Guid>("UserId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -107,16 +106,16 @@ namespace Govor.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<Guid>("GroupId")
|
b.Property<Guid>("GroupId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<bool>("IsBanned")
|
b.Property<bool>("IsBanned")
|
||||||
.HasColumnType("boolean");
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
b.Property<Guid>("UserId")
|
b.Property<Guid>("UserId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -127,30 +126,30 @@ namespace Govor.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<string>("Code")
|
b.Property<string>("Code")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.Property<DateTime>("DateCreated")
|
b.Property<DateTime>("DateCreated")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
b.Property<string>("Description")
|
b.Property<string>("Description")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.Property<DateTime>("EndDate")
|
b.Property<DateTime>("EndDate")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
b.Property<bool>("IsActive")
|
b.Property<bool>("IsActive")
|
||||||
.HasColumnType("boolean");
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
b.Property<bool>("IsAdmin")
|
b.Property<bool>("IsAdmin")
|
||||||
.HasColumnType("boolean");
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
b.Property<int>("MaxParticipants")
|
b.Property<int>("MaxParticipants")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -161,26 +160,26 @@ namespace Govor.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<string>("EncryptedKey")
|
b.Property<string>("EncryptedKey")
|
||||||
.HasMaxLength(512)
|
.HasMaxLength(512)
|
||||||
.HasColumnType("character varying(512)");
|
.HasColumnType("varchar(512)");
|
||||||
|
|
||||||
b.Property<string>("FilePath")
|
b.Property<string>("FilePath")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.Property<Guid>("MessageId")
|
b.Property<Guid>("MessageId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<string>("MimeType")
|
b.Property<string>("MimeType")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.Property<string>("Type")
|
b.Property<string>("Type")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -193,35 +192,35 @@ namespace Govor.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<DateTime?>("EditedAt")
|
b.Property<DateTime?>("EditedAt")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
b.Property<string>("EncryptedContent")
|
b.Property<string>("EncryptedContent")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.Property<bool>("IsEdited")
|
b.Property<bool>("IsEdited")
|
||||||
.HasColumnType("boolean");
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
b.Property<Guid?>("PrivateChatId")
|
b.Property<Guid?>("PrivateChatId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<Guid>("RecipientId")
|
b.Property<Guid>("RecipientId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<int>("RecipientType")
|
b.Property<int>("RecipientType")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<Guid?>("ReplyToMessageId")
|
b.Property<Guid?>("ReplyToMessageId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<Guid>("SenderId")
|
b.Property<Guid>("SenderId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<DateTime>("SentAt")
|
b.Property<DateTime>("SentAt")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -236,21 +235,21 @@ namespace Govor.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<Guid>("MessageId")
|
b.Property<Guid>("MessageId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<DateTime>("ReactedAt")
|
b.Property<DateTime>("ReactedAt")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
b.Property<string>("ReactionCode")
|
b.Property<string>("ReactionCode")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(64)
|
.HasMaxLength(64)
|
||||||
.HasColumnType("character varying(64)");
|
.HasColumnType("varchar(64)");
|
||||||
|
|
||||||
b.Property<Guid>("UserId")
|
b.Property<Guid>("UserId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -266,16 +265,16 @@ namespace Govor.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<Guid>("MessageId")
|
b.Property<Guid>("MessageId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<Guid>("UserId")
|
b.Property<Guid>("UserId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<DateTime>("ViewedAt")
|
b.Property<DateTime>("ViewedAt")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -289,13 +288,13 @@ namespace Govor.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<Guid>("UserAId")
|
b.Property<Guid>("UserAId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<Guid>("UserBId")
|
b.Property<Guid>("UserBId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -306,31 +305,31 @@ namespace Govor.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<DateOnly>("CreatedOn")
|
b.Property<DateOnly>("CreatedOn")
|
||||||
.HasColumnType("date");
|
.HasColumnType("date");
|
||||||
|
|
||||||
b.Property<string>("Description")
|
b.Property<string>("Description")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.Property<Guid>("IconId")
|
b.Property<Guid>("IconId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<Guid>("InviteId")
|
b.Property<Guid>("InviteId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<string>("PasswordHash")
|
b.Property<string>("PasswordHash")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.Property<string>("Username")
|
b.Property<string>("Username")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.Property<DateTime>("WasOnline")
|
b.Property<DateTime>("WasOnline")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user