using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Kynareth.Migrations
{
///
public partial class Initial : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterDatabase()
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Tokens",
columns: table => new
{
Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
ClientId = table.Column(type: "bigint unsigned", nullable: false),
Token = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
OwnerEmail = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Description = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
IsValid = table.Column(type: "tinyint(1)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Tokens", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Calls",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Route = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
TimeStamp = table.Column(type: "datetime(6)", nullable: false),
TokenId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_Calls", x => x.Id);
table.ForeignKey(
name: "FK_Calls_Tokens_TokenId",
column: x => x.TokenId,
principalTable: "Tokens",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_Calls_TokenId",
table: "Calls",
column: "TokenId");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Calls");
migrationBuilder.DropTable(
name: "Tokens");
}
}
}