mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
59 lines
2.0 KiB
C#
59 lines
2.0 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
namespace Kruzya.TelegramBot.Core.Migrations
|
|
{
|
|
public partial class Initial : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Users",
|
|
columns: table => new
|
|
{
|
|
BotUserId = table.Column<Guid>(nullable: false),
|
|
ChatId = table.Column<long>(nullable: false),
|
|
UserId = table.Column<int>(nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Users", x => x.BotUserId);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "UserValues",
|
|
columns: table => new
|
|
{
|
|
BotUserValueId = table.Column<Guid>(nullable: false),
|
|
BotUserId = table.Column<Guid>(nullable: true),
|
|
Name = table.Column<string>(nullable: true),
|
|
Value = table.Column<byte[]>(nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_UserValues", x => x.BotUserValueId);
|
|
table.ForeignKey(
|
|
name: "FK_UserValues_Users_BotUserId",
|
|
column: x => x.BotUserId,
|
|
principalTable: "Users",
|
|
principalColumn: "BotUserId",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_UserValues_BotUserId",
|
|
table: "UserValues",
|
|
column: "BotUserId");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "UserValues");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Users");
|
|
}
|
|
}
|
|
}
|