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

namespace ReallifeGamemode.Migrations
{
    public partial class Initial : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "BankAccountTransactionLogs",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Sender = table.Column<string>(maxLength: 32, nullable: true),
                    SenderBalance = table.Column<int>(nullable: false),
                    MoneySent = table.Column<int>(nullable: false),
                    Receiver = table.Column<string>(maxLength: 32, nullable: true),
                    ReceiverBalance = table.Column<int>(nullable: false),
                    NewSenderBalance = table.Column<int>(nullable: false),
                    NewReceiverBalance = table.Column<int>(nullable: false),
                    Fee = table.Column<int>(nullable: false),
                    Origin = table.Column<string>(maxLength: 32, nullable: true),
                    Timestamp = table.Column<DateTime>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_BankAccountTransactionLogs", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Blips",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Sprite = table.Column<short>(nullable: false),
                    PositionX = table.Column<float>(nullable: false),
                    PositionY = table.Column<float>(nullable: false),
                    PositionZ = table.Column<float>(nullable: false),
                    Name = table.Column<string>(nullable: true),
                    Scale = table.Column<float>(nullable: false),
                    Color = table.Column<byte>(nullable: false),
                    Alpha = table.Column<byte>(nullable: false),
                    DrawDistance = table.Column<float>(nullable: false),
                    ShortRange = table.Column<bool>(nullable: false),
                    Rotation = table.Column<float>(nullable: false),
                    Dimension = table.Column<byte>(nullable: false),
                    Active = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Blips", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "BusinessBankAccounts",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Balance = table.Column<int>(nullable: false),
                    BusinessId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_BusinessBankAccounts", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ClothCombinations",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Gender = table.Column<bool>(nullable: false),
                    Top = table.Column<int>(nullable: false),
                    Torso = table.Column<int>(nullable: false),
                    Undershirt = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ClothCombinations", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Factions",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Name = table.Column<string>(maxLength: 32, nullable: true),
                    StateOwned = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Factions", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "GotoPoints",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Description = table.Column<string>(maxLength: 32, nullable: true),
                    X = table.Column<float>(nullable: false),
                    Y = table.Column<float>(nullable: false),
                    Z = table.Column<float>(nullable: false),
                    Active = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_GotoPoints", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Interiors",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Name = table.Column<string>(nullable: true),
                    EnterPosition = table.Column<string>(nullable: true),
                    ExitPosition = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Interiors", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Markers",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Type = table.Column<byte>(nullable: false),
                    PositionX = table.Column<float>(nullable: false),
                    PositionY = table.Column<float>(nullable: false),
                    PositionZ = table.Column<float>(nullable: false),
                    Scale = table.Column<float>(nullable: false),
                    DirectionX = table.Column<float>(nullable: false),
                    DirectionY = table.Column<float>(nullable: false),
                    DirectionZ = table.Column<float>(nullable: false),
                    RotationX = table.Column<float>(nullable: false),
                    RotationY = table.Column<float>(nullable: false),
                    RotationZ = table.Column<float>(nullable: false),
                    ColorR = table.Column<byte>(nullable: false),
                    ColorG = table.Column<byte>(nullable: false),
                    ColorB = table.Column<byte>(nullable: false),
                    ColorA = table.Column<byte>(nullable: false),
                    Visible = table.Column<bool>(nullable: false),
                    Dimension = table.Column<byte>(nullable: false),
                    Active = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Markers", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Peds",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    HashModel = table.Column<string>(nullable: true),
                    PositionX = table.Column<float>(nullable: false),
                    PositionY = table.Column<float>(nullable: false),
                    PositionZ = table.Column<float>(nullable: false),
                    Heading = table.Column<float>(nullable: false),
                    Dimension = table.Column<byte>(nullable: false),
                    Active = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Peds", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Pickups",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    PositionX = table.Column<float>(maxLength: 128, nullable: false),
                    PositionY = table.Column<float>(nullable: false),
                    PositionZ = table.Column<float>(nullable: false),
                    RotationX = table.Column<float>(nullable: false),
                    RotationY = table.Column<float>(nullable: false),
                    RotationZ = table.Column<float>(nullable: false),
                    Vehicle = table.Column<bool>(nullable: false),
                    RespawnTime = table.Column<int>(nullable: false),
                    Dimension = table.Column<byte>(nullable: false),
                    Active = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Pickups", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "TextLabels",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Text = table.Column<string>(nullable: false),
                    PositionX = table.Column<float>(nullable: false),
                    PositionY = table.Column<float>(nullable: false),
                    PositionZ = table.Column<float>(nullable: false),
                    LOS = table.Column<bool>(nullable: false),
                    Font = table.Column<byte>(nullable: false),
                    DrawDistance = table.Column<float>(nullable: false),
                    ColorR = table.Column<byte>(nullable: false),
                    ColorG = table.Column<byte>(nullable: false),
                    ColorB = table.Column<byte>(nullable: false),
                    ColorA = table.Column<byte>(nullable: false),
                    Dimension = table.Column<byte>(nullable: false),
                    Active = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TextLabels", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "WhitelistEntries",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    SocialClubName = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WhitelistEntries", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Doors",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Category = table.Column<string>(nullable: true),
                    Name = table.Column<string>(nullable: true),
                    Locked = table.Column<bool>(nullable: false),
                    Model = table.Column<int>(nullable: false),
                    X = table.Column<float>(nullable: false),
                    Y = table.Column<float>(nullable: false),
                    Z = table.Column<float>(nullable: false),
                    Radius = table.Column<float>(nullable: false),
                    FactionId = table.Column<int>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Doors", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Doors_Factions_FactionId",
                        column: x => x.FactionId,
                        principalTable: "Factions",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "DutyClothes",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    FactionId = table.Column<int>(nullable: false),
                    Gender = table.Column<bool>(nullable: false),
                    SlotType = table.Column<byte>(nullable: false),
                    SlotId = table.Column<int>(nullable: false),
                    ClothId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DutyClothes", x => x.Id);
                    table.ForeignKey(
                        name: "FK_DutyClothes_Factions_FactionId",
                        column: x => x.FactionId,
                        principalTable: "Factions",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "FactionBankAccounts",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    FactionId = table.Column<int>(nullable: false),
                    Bic = table.Column<string>(maxLength: 12, nullable: true),
                    Iban = table.Column<string>(maxLength: 32, nullable: true),
                    Balance = table.Column<int>(nullable: false),
                    Active = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_FactionBankAccounts", x => x.Id);
                    table.ForeignKey(
                        name: "FK_FactionBankAccounts_Factions_FactionId",
                        column: x => x.FactionId,
                        principalTable: "Factions",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "FactionRanks",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    RankName = table.Column<string>(nullable: true),
                    Order = table.Column<int>(nullable: false),
                    FactionId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_FactionRanks", x => x.Id);
                    table.ForeignKey(
                        name: "FK_FactionRanks_Factions_FactionId",
                        column: x => x.FactionId,
                        principalTable: "Factions",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "Users",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Name = table.Column<string>(maxLength: 32, nullable: true),
                    SocialClubName = table.Column<string>(maxLength: 32, nullable: true),
                    Password = table.Column<string>(maxLength: 64, nullable: true),
                    LogUserId = table.Column<int>(nullable: false),
                    RegistrationDate = table.Column<DateTime>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Email = table.Column<string>(maxLength: 64, nullable: true),
                    AdminLevel = table.Column<int>(nullable: false),
                    Dead = table.Column<bool>(nullable: false),
                    PositionX = table.Column<float>(nullable: false),
                    PositionY = table.Column<float>(nullable: false),
                    PositionZ = table.Column<float>(nullable: false),
                    CharacterId = table.Column<int>(nullable: true),
                    BanId = table.Column<int>(nullable: true),
                    FactionId = table.Column<int>(nullable: true),
                    FactionLeader = table.Column<bool>(nullable: false),
                    FactionRankId = table.Column<int>(nullable: true),
                    BusinessId = table.Column<int>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Users", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Users_Factions_FactionId",
                        column: x => x.FactionId,
                        principalTable: "Factions",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_Users_FactionRanks_FactionRankId",
                        column: x => x.FactionRankId,
                        principalTable: "FactionRanks",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "Bans",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    UserId = table.Column<int>(nullable: false),
                    Reason = table.Column<string>(nullable: true),
                    BannedBy = table.Column<string>(nullable: true),
                    Applied = table.Column<int>(nullable: false),
                    UntilDateTime = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Bans", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Bans_Users_UserId",
                        column: x => x.UserId,
                        principalTable: "Users",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "CharacterClothes",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    UserId = table.Column<int>(nullable: false),
                    Duty = table.Column<bool>(nullable: false),
                    SlotType = table.Column<byte>(nullable: false),
                    SlotId = table.Column<int>(nullable: false),
                    ClothId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CharacterClothes", x => x.Id);
                    table.ForeignKey(
                        name: "FK_CharacterClothes_Users_UserId",
                        column: x => x.UserId,
                        principalTable: "Users",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "Characters",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    UserId = table.Column<int>(nullable: false),
                    Gender = table.Column<bool>(nullable: false),
                    Father = table.Column<byte>(nullable: false),
                    Mother = table.Column<byte>(nullable: false),
                    Similarity = table.Column<float>(nullable: false),
                    SkinSimilarity = table.Column<float>(nullable: false),
                    NoseWidth = table.Column<float>(nullable: false),
                    NoseBottomHeight = table.Column<float>(nullable: false),
                    NoseTipLength = table.Column<float>(nullable: false),
                    NoseBridgeDepth = table.Column<float>(nullable: false),
                    NoseTipHeight = table.Column<float>(nullable: false),
                    NoseBroken = table.Column<float>(nullable: false),
                    BrowHeight = table.Column<float>(nullable: false),
                    BrowDepth = table.Column<float>(nullable: false),
                    CheekboneHeight = table.Column<float>(nullable: false),
                    CheekboneWidth = table.Column<float>(nullable: false),
                    CheekDepth = table.Column<float>(nullable: false),
                    EyeSize = table.Column<float>(nullable: false),
                    LipThickness = table.Column<float>(nullable: false),
                    JawWidth = table.Column<float>(nullable: false),
                    JawShape = table.Column<float>(nullable: false),
                    ChinHeight = table.Column<float>(nullable: false),
                    ChinDepth = table.Column<float>(nullable: false),
                    ChinWidth = table.Column<float>(nullable: false),
                    ChinIndent = table.Column<float>(nullable: false),
                    NeckWidth = table.Column<float>(nullable: false),
                    Blemishes = table.Column<byte>(nullable: false),
                    BlemishesOpacity = table.Column<float>(nullable: false),
                    FacialHair = table.Column<byte>(nullable: false),
                    FacialHairOpacity = table.Column<float>(nullable: false),
                    Eyebrows = table.Column<byte>(nullable: false),
                    EyebrowsOpacity = table.Column<float>(nullable: false),
                    Ageing = table.Column<byte>(nullable: false),
                    AgeingOpacity = table.Column<float>(nullable: false),
                    Makeup = table.Column<byte>(nullable: false),
                    MakeupOpacity = table.Column<float>(nullable: false),
                    Blush = table.Column<byte>(nullable: false),
                    BlushOpacity = table.Column<float>(nullable: false),
                    Complexion = table.Column<byte>(nullable: false),
                    ComplexionOpacity = table.Column<float>(nullable: false),
                    SunDamage = table.Column<byte>(nullable: false),
                    SunDamageOpacity = table.Column<float>(nullable: false),
                    Lipstick = table.Column<byte>(nullable: false),
                    LipstickOpacity = table.Column<float>(nullable: false),
                    Freckles = table.Column<byte>(nullable: false),
                    FrecklesOpacity = table.Column<float>(nullable: false),
                    ChestHair = table.Column<byte>(nullable: false),
                    ChestHairOpacity = table.Column<float>(nullable: false),
                    Hair = table.Column<byte>(nullable: false),
                    HairColor = table.Column<byte>(nullable: false),
                    HairHighlightColor = table.Column<byte>(nullable: false),
                    EyebrowColor = table.Column<byte>(nullable: false),
                    BeardColor = table.Column<byte>(nullable: false),
                    EyeColor = table.Column<byte>(nullable: false),
                    BlushColor = table.Column<byte>(nullable: false),
                    LipstickColor = table.Column<byte>(nullable: false),
                    ChestHairColor = table.Column<byte>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Characters", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Characters_Users_UserId",
                        column: x => x.UserId,
                        principalTable: "Users",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "DeathLogs",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    VictimId = table.Column<int>(nullable: false),
                    KillerId = table.Column<int>(nullable: true),
                    VictimPositionX = table.Column<float>(nullable: false),
                    VictimPositionY = table.Column<float>(nullable: false),
                    VictimPositionZ = table.Column<float>(nullable: false),
                    VictimHeading = table.Column<float>(nullable: false),
                    KillerPositionX = table.Column<float>(nullable: false),
                    KillerPositionY = table.Column<float>(nullable: false),
                    KillerPositionZ = table.Column<float>(nullable: false),
                    KillerHeading = table.Column<float>(nullable: false),
                    CauseOfDeath = table.Column<string>(maxLength: 64, nullable: true),
                    Timestamp = table.Column<DateTime>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DeathLogs", x => x.Id);
                    table.ForeignKey(
                        name: "FK_DeathLogs_Users_KillerId",
                        column: x => x.KillerId,
                        principalTable: "Users",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_DeathLogs_Users_VictimId",
                        column: x => x.VictimId,
                        principalTable: "Users",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "News",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    UserId = table.Column<int>(nullable: true),
                    Caption = table.Column<string>(nullable: true),
                    Content = table.Column<string>(nullable: true),
                    Active = table.Column<bool>(nullable: false),
                    Timestamp = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_News", x => x.Id);
                    table.ForeignKey(
                        name: "FK_News_Users_UserId",
                        column: x => x.UserId,
                        principalTable: "Users",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "ServerVehicles",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Model = table.Column<uint>(nullable: false),
                    PositionX = table.Column<float>(nullable: false),
                    PositionY = table.Column<float>(nullable: false),
                    PositionZ = table.Column<float>(nullable: false),
                    Heading = table.Column<float>(nullable: false),
                    NumberPlate = table.Column<string>(maxLength: 8, nullable: true),
                    PrimaryColor = table.Column<int>(nullable: false),
                    SecondaryColor = table.Column<int>(nullable: false),
                    Locked = table.Column<bool>(nullable: false),
                    Active = table.Column<bool>(nullable: false, defaultValue: true),
                    Discriminator = table.Column<string>(nullable: false),
                    FactionId = table.Column<int>(nullable: true),
                    ShopId = table.Column<int>(nullable: true),
                    BusinessId = table.Column<int>(nullable: true),
                    Price = table.Column<int>(nullable: true),
                    UserId = table.Column<int>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ServerVehicles", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ServerVehicles_Factions_FactionId",
                        column: x => x.FactionId,
                        principalTable: "Factions",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_ServerVehicles_Users_UserId",
                        column: x => x.UserId,
                        principalTable: "Users",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "UserBankAccounts",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    UserId = table.Column<int>(nullable: false),
                    Bic = table.Column<string>(maxLength: 12, nullable: true),
                    Iban = table.Column<string>(maxLength: 32, nullable: true),
                    Balance = table.Column<int>(nullable: false),
                    Active = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UserBankAccounts", x => x.Id);
                    table.ForeignKey(
                        name: "FK_UserBankAccounts_Users_UserId",
                        column: x => x.UserId,
                        principalTable: "Users",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "UserItems",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    ItemId = table.Column<int>(nullable: false),
                    UserId = table.Column<int>(nullable: false),
                    Amount = table.Column<int>(nullable: false),
                    Slot = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UserItems", x => x.Id);
                    table.ForeignKey(
                        name: "FK_UserItems_Users_UserId",
                        column: x => x.UserId,
                        principalTable: "Users",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "VehicleMods",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    ServerVehicleId = table.Column<int>(nullable: false),
                    Slot = table.Column<int>(nullable: false),
                    ModId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_VehicleMods", x => x.Id);
                    table.ForeignKey(
                        name: "FK_VehicleMods_ServerVehicles_ServerVehicleId",
                        column: x => x.ServerVehicleId,
                        principalTable: "ServerVehicles",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateIndex(
                name: "IX_Bans_UserId",
                table: "Bans",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_BusinessBankAccounts_BusinessId",
                table: "BusinessBankAccounts",
                column: "BusinessId",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_CharacterClothes_UserId",
                table: "CharacterClothes",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_Characters_UserId",
                table: "Characters",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_DeathLogs_KillerId",
                table: "DeathLogs",
                column: "KillerId");

            migrationBuilder.CreateIndex(
                name: "IX_DeathLogs_VictimId",
                table: "DeathLogs",
                column: "VictimId");

            migrationBuilder.CreateIndex(
                name: "IX_Doors_FactionId",
                table: "Doors",
                column: "FactionId");

            migrationBuilder.CreateIndex(
                name: "IX_DutyClothes_FactionId",
                table: "DutyClothes",
                column: "FactionId");

            migrationBuilder.CreateIndex(
                name: "IX_FactionBankAccounts_FactionId",
                table: "FactionBankAccounts",
                column: "FactionId");

            migrationBuilder.CreateIndex(
                name: "IX_FactionRanks_FactionId",
                table: "FactionRanks",
                column: "FactionId");

            migrationBuilder.CreateIndex(
                name: "IX_News_UserId",
                table: "News",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_ServerVehicles_FactionId",
                table: "ServerVehicles",
                column: "FactionId");

            migrationBuilder.CreateIndex(
                name: "IX_ServerVehicles_UserId",
                table: "ServerVehicles",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_UserBankAccounts_UserId",
                table: "UserBankAccounts",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_UserItems_UserId",
                table: "UserItems",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_Users_BanId",
                table: "Users",
                column: "BanId");

            migrationBuilder.CreateIndex(
                name: "IX_Users_BusinessId",
                table: "Users",
                column: "BusinessId",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_Users_CharacterId",
                table: "Users",
                column: "CharacterId");

            migrationBuilder.CreateIndex(
                name: "IX_Users_FactionId",
                table: "Users",
                column: "FactionId");

            migrationBuilder.CreateIndex(
                name: "IX_Users_FactionRankId",
                table: "Users",
                column: "FactionRankId");

            migrationBuilder.CreateIndex(
                name: "IX_VehicleMods_ServerVehicleId_Slot",
                table: "VehicleMods",
                columns: new[] { "ServerVehicleId", "Slot" },
                unique: true);

            migrationBuilder.AddForeignKey(
                name: "FK_Users_Bans_BanId",
                table: "Users",
                column: "BanId",
                principalTable: "Bans",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_Users_Characters_CharacterId",
                table: "Users",
                column: "CharacterId",
                principalTable: "Characters",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Bans_Users_UserId",
                table: "Bans");

            migrationBuilder.DropForeignKey(
                name: "FK_Characters_Users_UserId",
                table: "Characters");

            migrationBuilder.DropTable(
                name: "BankAccountTransactionLogs");

            migrationBuilder.DropTable(
                name: "Blips");

            migrationBuilder.DropTable(
                name: "BusinessBankAccounts");

            migrationBuilder.DropTable(
                name: "CharacterClothes");

            migrationBuilder.DropTable(
                name: "ClothCombinations");

            migrationBuilder.DropTable(
                name: "DeathLogs");

            migrationBuilder.DropTable(
                name: "Doors");

            migrationBuilder.DropTable(
                name: "DutyClothes");

            migrationBuilder.DropTable(
                name: "FactionBankAccounts");

            migrationBuilder.DropTable(
                name: "GotoPoints");

            migrationBuilder.DropTable(
                name: "Interiors");

            migrationBuilder.DropTable(
                name: "Markers");

            migrationBuilder.DropTable(
                name: "News");

            migrationBuilder.DropTable(
                name: "Peds");

            migrationBuilder.DropTable(
                name: "Pickups");

            migrationBuilder.DropTable(
                name: "TextLabels");

            migrationBuilder.DropTable(
                name: "UserBankAccounts");

            migrationBuilder.DropTable(
                name: "UserItems");

            migrationBuilder.DropTable(
                name: "VehicleMods");

            migrationBuilder.DropTable(
                name: "WhitelistEntries");

            migrationBuilder.DropTable(
                name: "ServerVehicles");

            migrationBuilder.DropTable(
                name: "Users");

            migrationBuilder.DropTable(
                name: "Bans");

            migrationBuilder.DropTable(
                name: "Characters");

            migrationBuilder.DropTable(
                name: "FactionRanks");

            migrationBuilder.DropTable(
                name: "Factions");
        }
    }
}
