mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
initial chat options implementation
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Kruzya.TelegramBot.Core.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Kruzya.TelegramBot.Core.Migrations
|
||||
{
|
||||
[DbContext(typeof(CoreContext))]
|
||||
[Migration("20230720171645_AddChatOptions")]
|
||||
partial class AddChatOptions
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.1")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
modelBuilder.Entity("Kruzya.TelegramBot.Core.Data.BotUser", b =>
|
||||
{
|
||||
b.Property<Guid>("BotUserId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<long>("ChatId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("UserId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("BotUserId");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kruzya.TelegramBot.Core.Data.BotUserValue", b =>
|
||||
{
|
||||
b.Property<Guid>("BotUserValueId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("BotUserId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<byte[]>("Value")
|
||||
.HasColumnType("longblob");
|
||||
|
||||
b.Property<string>("ValueType")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("BotUserValueId");
|
||||
|
||||
b.HasIndex("BotUserId");
|
||||
|
||||
b.ToTable("UserValues");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kruzya.TelegramBot.Core.Data.ChatOptionValue", b =>
|
||||
{
|
||||
b.Property<long>("ChatId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("OptionId")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<byte[]>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("longblob");
|
||||
|
||||
b.HasKey("ChatId", "OptionId");
|
||||
|
||||
b.ToTable("ChatOptionValues");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kruzya.TelegramBot.Core.Data.BotUserValue", b =>
|
||||
{
|
||||
b.HasOne("Kruzya.TelegramBot.Core.Data.BotUser", "BotUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("BotUserId");
|
||||
|
||||
b.Navigation("BotUser");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Kruzya.TelegramBot.Core.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddChatOptions : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ChatOptionValues",
|
||||
columns: table => new
|
||||
{
|
||||
ChatId = table.Column<long>(type: "bigint", nullable: false),
|
||||
OptionId = table.Column<string>(type: "varchar(255)", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Value = table.Column<byte[]>(type: "longblob", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ChatOptionValues", x => new { x.ChatId, x.OptionId });
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "ChatOptionValues");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "ValueType",
|
||||
table: "UserValues",
|
||||
type: "longtext CHARACTER SET utf8mb4",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext",
|
||||
oldNullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Name",
|
||||
table: "UserValues",
|
||||
type: "longtext CHARACTER SET utf8mb4",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext",
|
||||
oldNullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,8 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Kruzya.TelegramBot.Core.Migrations
|
||||
{
|
||||
[DbContext(typeof(CoreContext))]
|
||||
@@ -14,7 +16,7 @@ namespace Kruzya.TelegramBot.Core.Migrations
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "3.1.2")
|
||||
.HasAnnotation("ProductVersion", "7.0.1")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
modelBuilder.Entity("Kruzya.TelegramBot.Core.Data.BotUser", b =>
|
||||
@@ -44,13 +46,13 @@ namespace Kruzya.TelegramBot.Core.Migrations
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4");
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<byte[]>("Value")
|
||||
.HasColumnType("longblob");
|
||||
|
||||
b.Property<string>("ValueType")
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4");
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("BotUserValueId");
|
||||
|
||||
@@ -59,11 +61,30 @@ namespace Kruzya.TelegramBot.Core.Migrations
|
||||
b.ToTable("UserValues");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kruzya.TelegramBot.Core.Data.ChatOptionValue", b =>
|
||||
{
|
||||
b.Property<long>("ChatId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("OptionId")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<byte[]>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("longblob");
|
||||
|
||||
b.HasKey("ChatId", "OptionId");
|
||||
|
||||
b.ToTable("ChatOptionValues");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kruzya.TelegramBot.Core.Data.BotUserValue", b =>
|
||||
{
|
||||
b.HasOne("Kruzya.TelegramBot.Core.Data.BotUser", "BotUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("BotUserId");
|
||||
|
||||
b.Navigation("BotUser");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user