using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace ReallifeGamemode.Database.Migrations
{
    public partial class LoginLogoutLogs : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "LoginLogoutLogs",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Username = table.Column<string>(nullable: true),
                    SocialClubName = table.Column<string>(nullable: true),
                    UserId = table.Column<int>(nullable: true),
                    PlayerId = table.Column<long>(nullable: false),
                    IpAddress = table.Column<string>(nullable: true),
                    LoginLogout = table.Column<bool>(nullable: false),
                    Time = table.Column<DateTime>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_LoginLogoutLogs", x => x.Id);
                    table.ForeignKey(
                        name: "FK_LoginLogoutLogs_Users_UserId",
                        column: x => x.UserId,
                        principalTable: "Users",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateIndex(
                name: "IX_LoginLogoutLogs_UserId",
                table: "LoginLogoutLogs",
                column: "UserId");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "LoginLogoutLogs");
        }
    }
}
