diff --git a/cncnet-api/.env.example b/cncnet-api/.env.example index b924676c..c1c9aba1 100755 --- a/cncnet-api/.env.example +++ b/cncnet-api/.env.example @@ -7,19 +7,26 @@ APP_URL=http://localhost ASSET_URL=http://localhost URL=http://localhost -# Laravel mysql config +# Mysql config DB_HOST="mysql" DB_DATABASE="cncnet_api" DB_USERNAME="cncnet" DB_PASSWORD="cncnet" -# Mysql config +# IRC Mysql config +DB_IRC_DATABASE="cncnet_irc" + +# Main Ladder Mysql config MYSQL_DATABASE="cncnet_api" MYSQL_USER="cncnet" MYSQL_PASSWORD="cncnet" MYSQL_ALLOW_EMPTY_PASSWORD="false" MYSQL_ROOT_PASSWORD="yourRandomRootPass" +# IRC Mysql config +MYSQL_IRC_HOST=mysql +MYSQL_IRC_DATABASE=cncnet_irc + CACHE_DRIVER="file" SESSION_DRIVER="cookie" QUEUE_DRIVER="database" diff --git a/cncnet-api/app/Http/Controllers/Admin/IrcBanController.php b/cncnet-api/app/Http/Controllers/Admin/IrcBanController.php new file mode 100644 index 00000000..1e571d18 --- /dev/null +++ b/cncnet-api/app/Http/Controllers/Admin/IrcBanController.php @@ -0,0 +1,108 @@ +ircBanService = $ircBanService; + } + + public function getBanIndex() + { + $bans = IrcBan::limit(20)->orderBy("created_at", "desc")->get(); + $warnings = IrcWarning::limit(20)->orderBy("created_at", "desc")->get(); + return view('admin.irc.index', compact('bans', 'warnings')); + } + + public function getAllBans() + { + $bans = IrcBan::orderBy("created_at", "desc")->paginate(20); + return view('admin.irc.bans', compact('bans')); + } + + public function getCreateBan(Request $request) + { + return view('admin.irc.create'); + } + + public function createBan(CreateIrcBanRequest $request) + { + // Safety checks + if ($request->username == null && $request->ident == null && $request->host == null) + { + return redirect()->back()->withErrors(["You just banned everyone on the CnCNet server. Just kidding. Specify at least one value in the fields: user, ident or host"])->withInput(); + } + + if ($request->channel == null && $request->global_ban != "on") + { + return redirect()->back()->withErrors(["Which channel(s) are we banning this user from?"])->withInput(); + } + + $ircBan = $this->ircBanService->saveBan( + banReason: $request->ban_reason, + adminId: Auth::user()->id, + channel: $request->channel, + globalBan: $request->global_ban == "on", + username: $request->username, + ident: $request->ident, + host: $request->host, + expiresAt: $request->expires_at + ); + + return redirect()->route('admin.irc.bans.edit', ['id' => $ircBan->id])->with('status', 'Ban created'); + } + + public function getEditBan(Request $request) + { + $ban = IrcBan::findOrFail($request->id); + return view('admin.irc.edit', compact('ban')); + } + + public function updateBan(Request $request) + { + $ban = IrcBan::findOrFail($request->ban_id); + + // Safety checks + if ($request->username == null && $request->ident == null && $request->host == null) + { + return redirect()->back()->withErrors(["You just banned everyone on the CnCNet server. Just kidding. Specify at least one value in the fields: username, ident or host"])->withInput(); + } + + if ($request->channel == null && $request->global_ban != "on") + { + return redirect()->back()->withErrors(["Which channel(s) are we banning this user from?"])->withInput(); + } + + $this->ircBanService->updateBan( + banId: $ban->id, + banReason: $request->ban_reason, + adminId: Auth::user()->id, + channel: $request->channel, + globalBan: $request->global_ban == "on", + expiresAt: $request->expires_at + ); + + return redirect()->back()->with('status', 'Ban updated'); + } + + public function expireBan(Request $request) + { + $ban = IrcBan::findOrFail($request->ban_id); + $this->ircBanService->expireBan($ban, Auth::user()->id); + return redirect()->back()->with('status', 'Ban expired'); + } +} diff --git a/cncnet-api/app/Http/Controllers/Admin/IrcWarningController.php b/cncnet-api/app/Http/Controllers/Admin/IrcWarningController.php new file mode 100644 index 00000000..817effa2 --- /dev/null +++ b/cncnet-api/app/Http/Controllers/Admin/IrcWarningController.php @@ -0,0 +1,95 @@ +ircWarningService = $ircWarningService; + } + + public function getAllWarnings() + { + $warnings = IrcWarning::orderBy("created_at", "desc")->paginate(20); + return view('admin.irc.warnings', compact('warnings')); + } + + public function getCreateWarning(Request $request) + { + return view('admin.irc.warning-create'); + } + + public function getEditWarning(Request $request) + { + $warning = IrcWarning::findOrFail($request->id); + return view('admin.irc.warning-edit', compact('warning')); + } + + public function createWarning(Request $request) + { + // Safety checks + if ($request->username == null && $request->ident == null) + { + return redirect()->back()->withErrors(["Specify at least one value in the fields: user or ident"])->withInput(); + } + + if ($request->channel == null) + { + return redirect()->back()->withErrors(["Specify a channel this user will receive this message"])->withInput(); + } + + $this->ircWarningService->issueWarning( + adminId: Auth::user()->id, + username: $request->username, + ident: $request->ident, + warningMessage: $request->warning_message, + channel: $request->channel + ); + + return redirect()->route('admin.irc.warnings')->with('status', 'Warning created'); + } + + public function expireWarning(Request $request) + { + $this->ircWarningService->expireWarning($request->id); + return redirect()->route('admin.irc.warnings')->with('status', 'Warning expired'); + } + + public function updateWarning(Request $request) + { + // Safety checks + if ($request->username == null && $request->ident == null) + { + return redirect()->back()->withErrors(["Specify at least one value in the fields: user or ident"])->withInput(); + } + + if ($request->channel == null) + { + return redirect()->back()->withErrors(["Specify a channel this user will receive this message"])->withInput(); + } + + $this->ircWarningService->updateWarning( + warningId: $request->warning_id, + adminId: Auth::user()->id, + username: $request->username, + ident: $request->ident, + warningMessage: $request->warning_message, + channel: $request->channel + ); + + return redirect()->route('admin.irc.warnings.edit', ['id' => $request->warning_id])->with('status', 'Warning updated'); + } +} diff --git a/cncnet-api/app/Http/Controllers/Admin/PodiumController.php b/cncnet-api/app/Http/Controllers/Admin/PodiumController.php index d32825d1..a7b2d45d 100644 --- a/cncnet-api/app/Http/Controllers/Admin/PodiumController.php +++ b/cncnet-api/app/Http/Controllers/Admin/PodiumController.php @@ -3,7 +3,7 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; -use App\Http\Requests\Admi\Podium\ComputePodiumRequest; +use App\Http\Requests\Admin\Podium\ComputePodiumRequest; use App\Models\Ladder; use Illuminate\Http\Request; use Illuminate\Support\Carbon; @@ -26,11 +26,13 @@ public function getPodiumForm() return view('admin.podium', compact('ladders', 'fromDate', 'toDate')); } - public function computePodium(ComputePodiumRequest $request) { + public function computePodium(ComputePodiumRequest $request) + { - if (RateLimiter::tooManyAttempts($this->getRateLimiterKey(), 1)) { + if (RateLimiter::tooManyAttempts($this->getRateLimiterKey(), 1)) + { $seconds = RateLimiter::availableIn($this->getRateLimiterKey()); - $message = 'Don\'t submit this form this too often... You may try again in '.$seconds.' seconds.'; + $message = 'Don\'t submit this form this too often... You may try again in ' . $seconds . ' seconds.'; return view('admin.podium.result-too-many-attempts', compact('message')); } @@ -63,7 +65,8 @@ public function computePodium(ComputePodiumRequest $request) { return view('admin.podium.result', compact('players', 'from', 'to', 'ladder')); } - private function getRateLimiterKey() { - return 'compute-podium-win-count:'.auth()->id(); + private function getRateLimiterKey() + { + return 'compute-podium-win-count:' . auth()->id(); } } diff --git a/cncnet-api/app/Http/Controllers/Api/V2/Bans/ApiBanController.php b/cncnet-api/app/Http/Controllers/Api/V2/Bans/ApiBanController.php index 4cb2a338..fdba6f35 100644 --- a/cncnet-api/app/Http/Controllers/Api/V2/Bans/ApiBanController.php +++ b/cncnet-api/app/Http/Controllers/Api/V2/Bans/ApiBanController.php @@ -3,53 +3,34 @@ namespace App\Http\Controllers\Api\V2\Bans; use App\Http\Controllers\Controller; -use App\Http\Services\AuthService; -use App\Http\Services\LadderService; -use App\Http\Services\PlayerService; -use App\Models\PlayerActiveHandle; -use Carbon\Carbon; +use App\Http\Services\IrcBanService; +use App\Http\Services\IrcWarningService; use Illuminate\Http\Request; class ApiBanController extends Controller { - private $authService; - private $ladderService; - private $playerService; + protected IrcBanService $ircBanService; + protected IrcWarningService $ircWarningService; - public function __construct() + public function __construct(IrcBanService $ircBanService, IrcWarningService $ircWarningService) { - $this->authService = new AuthService(); - $this->playerService = new PlayerService; - $this->ladderService = new LadderService; + $this->ircBanService = $ircBanService; + $this->ircWarningService = $ircWarningService; } public function getBans() { - return [ - [ - "user" => "cncnet", - "ident" => "a964ad", - "host" => "gamesurge-d3a0cd5b.res.spectrum.com", - "kickBan" => true - ], - [ - "user" => null, - "ident" => "t364ad", - "host" => null, - "kickBan" => false - ], - [ - "user" => null, - "ident" => "", - "host" => "*.res.spectrum.com", - "kickBan" => false - ], - [ - "user" => "cncnet-moderator", - "ident" => null, - "host" => null, - "kickBan" => true - ], - ]; + return $this->ircBanService->getActiveBans(); + } + + public function getWarnings() + { + return $this->ircWarningService->getActiveWarnings(); + } + + public function receiveWarningAcknowledgments(Request $request) + { + $this->ircWarningService->acknowledgeWarningsByUser($request->usernames); + return response()->json(["success" => true], 200); } } diff --git a/cncnet-api/app/Http/Requests/Admin/Irc/CreateIrcBanRequest.php b/cncnet-api/app/Http/Requests/Admin/Irc/CreateIrcBanRequest.php new file mode 100644 index 00000000..f376b938 --- /dev/null +++ b/cncnet-api/app/Http/Requests/Admin/Irc/CreateIrcBanRequest.php @@ -0,0 +1,29 @@ +|string> + */ + public function rules(): array + { + return [ + 'ban_reason' => 'required', + ]; + } +} diff --git a/cncnet-api/app/Http/Requests/Admi/Podium/ComputePodiumRequest.php b/cncnet-api/app/Http/Requests/Admin/Podium/ComputePodiumRequest.php similarity index 95% rename from cncnet-api/app/Http/Requests/Admi/Podium/ComputePodiumRequest.php rename to cncnet-api/app/Http/Requests/Admin/Podium/ComputePodiumRequest.php index d595c9d6..131487a8 100644 --- a/cncnet-api/app/Http/Requests/Admi/Podium/ComputePodiumRequest.php +++ b/cncnet-api/app/Http/Requests/Admin/Podium/ComputePodiumRequest.php @@ -1,6 +1,6 @@ ident = $ident; + $ircBan->host = $host; + $ircBan->username = $username; + + $ircBan->admin_id = $adminId; + $ircBan->channel = $channel; + $ircBan->global_ban = $globalBan ?? false; + $ircBan->ban_reason = $banReason; + $ircBan->ban_original_expiry = $expiresAt; + $ircBan->expires_at = $expiresAt; + + $ircBan->save(); + + $this->saveLog($ircBan->id, $adminId, IrcBanLog::ACTION_CREATED); + + return $ircBan; + } + + public function updateBan( + string $banId, + string $banReason, + string $adminId, + string|null $channel, + bool|null $globalBan, + string|null $expiresAt + ): void + { + $ircBan = IrcBan::find($banId); + + $ircBan->admin_id = $adminId; + $ircBan->channel = $channel; + $ircBan->global_ban = $globalBan ?? false; + $ircBan->ban_reason = $banReason; + $ircBan->expires_at = $expiresAt; + $ircBan->save(); + + $this->saveLog($ircBan->id, $adminId, IrcBanLog::ACTION_UPDATED); + } + + public function expireBan(IrcBan $ban, string $adminId): void + { + $this->saveLog( + banId: $ban->id, + adminId: $adminId, + action: IrcBanLog::ACTION_EXPIRED, + ); + + $ban->expires_at = Carbon::now(); + $ban->save(); + } + + private function saveLog( + string $banId, + string $adminId, + string $action, + ): IrcBanLog + { + $ircLog = new IrcBanLog(); + $ircLog->ban_id = $banId; + $ircLog->admin_id = $adminId; + $ircLog->action = $action; + $ircLog->save(); + return $ircLog; + } + + public function getActiveBans() + { + $now = Carbon::now(); + $activeBans = IrcBan::select(["ident", "host", "username", "channel", "expires_at"])->get(); + + foreach ($activeBans as $ban) + { + $ban->has_expired = $ban->expires_at ? $ban->expires_at->isBefore($now) : false; + } + + return response()->json($activeBans); + } +} diff --git a/cncnet-api/app/Http/Services/IrcWarningService.php b/cncnet-api/app/Http/Services/IrcWarningService.php new file mode 100644 index 00000000..361de61f --- /dev/null +++ b/cncnet-api/app/Http/Services/IrcWarningService.php @@ -0,0 +1,63 @@ +admin_id = $adminId; + $ircWarning->username = $username; + $ircWarning->ident = $ident; + $ircWarning->warning_message = $warningMessage; + $ircWarning->channel = $channel; + $ircWarning->expired = false; + $ircWarning->save(); + return $ircWarning; + } + + public function updateWarning(string $warningId, string $adminId, string|null $username, string|null $ident, string $warningMessage, string $channel) + { + $ircWarning = IrcWarning::find($warningId); + $ircWarning->admin_id = $adminId; + $ircWarning->username = $username; + $ircWarning->ident = $ident; + $ircWarning->warning_message = $warningMessage; + $ircWarning->channel = $channel; + $ircWarning->save(); + return $ircWarning; + } + + public function expireWarning(string $ircWarningId): void + { + $ircWarning = IrcWarning::findOrFail($ircWarningId); + $ircWarning->expired = true; + $ircWarning->save(); + } + + public function getActiveWarnings() + { + return IrcWarning::where("acknowledged", false) + ->where("expired", false) + ->select(["ident", "username", "channel", "warning_message"]) + ->get(); + } + + public function acknowledgeWarningsByUser(array $usernames) + { + return IrcWarning::where("acknowledged", false)->whereIn("username", $usernames)->update([ + "acknowledged" => true + ]); + } +} diff --git a/cncnet-api/app/Models/IrcBan.php b/cncnet-api/app/Models/IrcBan.php new file mode 100644 index 00000000..e39b03aa --- /dev/null +++ b/cncnet-api/app/Models/IrcBan.php @@ -0,0 +1,22 @@ + 'datetime', + 'ban_original_expiry' => 'datetime', + ]; + + public function logs() + { + return $this->hasMany(IrcBanLog::class, 'ban_id'); + } +} diff --git a/cncnet-api/app/Models/IrcBanLog.php b/cncnet-api/app/Models/IrcBanLog.php new file mode 100644 index 00000000..9e2b5f2e --- /dev/null +++ b/cncnet-api/app/Models/IrcBanLog.php @@ -0,0 +1,14 @@ + 'datetime', + 'ban_original_expiry' => 'datetime', + ]; +} diff --git a/cncnet-api/config/database.php b/cncnet-api/config/database.php index b484e166..89829715 100755 --- a/cncnet-api/config/database.php +++ b/cncnet-api/config/database.php @@ -13,7 +13,7 @@ | */ - 'default' => env('DB_CONNECTION', 'mariadb'), + 'default' => env('DB_CONNECTION', 'mariadb'), /* |-------------------------------------------------------------------------- @@ -33,9 +33,17 @@ 'connections' => [ + 'irc' => [ + 'driver' => 'mariadb', + 'host' => env('MYSQL_IRC_HOST', 'mysql'), + 'database' => env('MYSQL_IRC_DATABASE', 'mysql'), + 'username' => env('MYSQL_USERNAME', 'cncnet'), + 'password' => env('MYSQL_PASSWORD', 'cncnet'), + ], + 'sqlite' => [ 'driver' => 'sqlite', - 'database' => storage_path().'/database.sqlite', + 'database' => storage_path() . '/database.sqlite', 'prefix' => '', ], @@ -51,17 +59,17 @@ 'strict' => false, ], - 'testing' => [ - 'driver' => 'mariadb', - 'host' => env('DB_HOST', 'localhost'), - 'database' => 'cncnet_api_testing', - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, - ], + 'testing' => [ + 'driver' => 'mariadb', + 'host' => env('DB_HOST', 'localhost'), + 'database' => 'cncnet_api_testing', + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, + ], ], @@ -101,8 +109,8 @@ ], - /* Maxmind GeoIP Database */ - 'mmdb' => [ - 'file' => database_path() . '/GeoLite2-City/GeoLite2-City.mmdb' - ], + /* Maxmind GeoIP Database */ + 'mmdb' => [ + 'file' => database_path() . '/GeoLite2-City/GeoLite2-City.mmdb' + ], ]; diff --git a/cncnet-api/database/migrations/2024_07_17_080047_create_irc_ban_logs_table.php b/cncnet-api/database/migrations/2024_07_17_080047_create_irc_ban_logs_table.php new file mode 100644 index 00000000..bba16081 --- /dev/null +++ b/cncnet-api/database/migrations/2024_07_17_080047_create_irc_ban_logs_table.php @@ -0,0 +1,31 @@ +create('irc_ban_logs', function (Blueprint $table) + { + $table->id(); + $table->unsignedInteger("ban_id"); + $table->unsignedBigInteger("admin_id"); + $table->string("action"); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('irc_bans'); + } +}; diff --git a/cncnet-api/database/migrations/2024_07_17_080047_create_irc_bans_table.php b/cncnet-api/database/migrations/2024_07_17_080047_create_irc_bans_table.php new file mode 100644 index 00000000..42460119 --- /dev/null +++ b/cncnet-api/database/migrations/2024_07_17_080047_create_irc_bans_table.php @@ -0,0 +1,37 @@ +create('irc_bans', function (Blueprint $table) + { + $table->id(); + $table->string("ident")->nullable(); + $table->string("host")->nullable(); + $table->string("username")->nullable(); + $table->string("channel")->nullable(); + $table->boolean("global_ban")->default(false); + $table->string("ban_reason"); + $table->unsignedInteger("admin_id"); + $table->timestamp("ban_original_expiry")->nullable(); // Keep as a reference + $table->timestamp("expires_at")->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('irc_bans'); + } +}; diff --git a/cncnet-api/database/migrations/2024_07_17_080048_create_irc_messages_table.php b/cncnet-api/database/migrations/2024_07_17_080048_create_irc_messages_table.php new file mode 100644 index 00000000..56b37295 --- /dev/null +++ b/cncnet-api/database/migrations/2024_07_17_080048_create_irc_messages_table.php @@ -0,0 +1,34 @@ +create('irc_messages', function (Blueprint $table) + { + $table->id(); + $table->string("ident"); + $table->string("message"); + $table->string("host"); + $table->string("username"); + $table->string("channel"); + $table->string("client"); + $table->timestamp("message_created"); // Bot will tell us when it syncs + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('irc_bans'); + } +}; diff --git a/cncnet-api/database/migrations/2024_07_17_080049_create_irc_users_table.php b/cncnet-api/database/migrations/2024_07_17_080049_create_irc_users_table.php new file mode 100644 index 00000000..95ead0fc --- /dev/null +++ b/cncnet-api/database/migrations/2024_07_17_080049_create_irc_users_table.php @@ -0,0 +1,31 @@ +create('irc_users', function (Blueprint $table) + { + $table->id(); + $table->string("ident"); + $table->string("username"); + $table->string("host"); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('irc_bans'); + } +}; diff --git a/cncnet-api/database/migrations/2024_07_17_080059_create_irc_warnings_table.php b/cncnet-api/database/migrations/2024_07_17_080059_create_irc_warnings_table.php new file mode 100644 index 00000000..a9041fca --- /dev/null +++ b/cncnet-api/database/migrations/2024_07_17_080059_create_irc_warnings_table.php @@ -0,0 +1,35 @@ +create('irc_warnings', function (Blueprint $table) + { + $table->id(); + $table->string("ident")->nullable(); + $table->string("username")->nullable(); + $table->string("channel")->nullable(); + $table->string("warning_message"); + $table->unsignedInteger("admin_id"); + $table->boolean("acknowledged")->default(false); + $table->boolean("expired")->default(false); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('irc_bans'); + } +}; diff --git a/cncnet-api/resources/views/admin/index.blade.php b/cncnet-api/resources/views/admin/index.blade.php index 073f9328..ec667647 100755 --- a/cncnet-api/resources/views/admin/index.blade.php +++ b/cncnet-api/resources/views/admin/index.blade.php @@ -77,6 +77,7 @@
  • Chat Ban User List
  • User Ratings
  • Clan List
  • +
  • IRC Manager
  • diff --git a/cncnet-api/resources/views/admin/irc/bans.blade.php b/cncnet-api/resources/views/admin/irc/bans.blade.php new file mode 100644 index 00000000..a42de7b8 --- /dev/null +++ b/cncnet-api/resources/views/admin/irc/bans.blade.php @@ -0,0 +1,89 @@ +@extends('layouts.app') +@section('title', 'Ladder') + +@section('feature') + + CnCNet IRC Bans + + Manage all IRC Bans + + + + +@endsection + +@section('breadcrumb') + +@endsection + +@section('content') +
    +
    + +
    + + +
    + {{ $bans->links() }} + + @include('admin.irc.components.bans.bans-table') + + {{ $bans->links() }} +
    +
    +
    +
    +@endsection diff --git a/cncnet-api/resources/views/admin/irc/components/bans/ban-expire-form.blade.php b/cncnet-api/resources/views/admin/irc/components/bans/ban-expire-form.blade.php new file mode 100644 index 00000000..29fe7feb --- /dev/null +++ b/cncnet-api/resources/views/admin/irc/components/bans/ban-expire-form.blade.php @@ -0,0 +1,5 @@ +
    + @csrf + + +
    diff --git a/cncnet-api/resources/views/admin/irc/components/bans/ban-form.blade.php b/cncnet-api/resources/views/admin/irc/components/bans/ban-form.blade.php new file mode 100644 index 00000000..84035443 --- /dev/null +++ b/cncnet-api/resources/views/admin/irc/components/bans/ban-form.blade.php @@ -0,0 +1,70 @@ +
    + + @if ($ban) + + @endif + + @csrf +

    + You must enter at least one value for User, Ident or Host. If one type is left blank, the bot will not ban by this field. +

    + +
    + Username + + username) readonly @endif> + + Ident + + ident) readonly @endif> + + Host + + host) readonly @endif> +
    + +
    + Reason for the ban + +
    + +
    + + + + OR + +
    + global_ban != null) checked @endif> +
    + + +
    + +
    + When will the ban expire? (Leave blank for never) + +
    + + @if (count($errors) > 0) +
    +
      + @foreach ($errors->all() as $error) +
    • {{ $error }}
    • + @endforeach +
    +
    + @endif + + +
    diff --git a/cncnet-api/resources/views/admin/irc/components/bans/bans-table.blade.php b/cncnet-api/resources/views/admin/irc/components/bans/bans-table.blade.php new file mode 100644 index 00000000..697c5b00 --- /dev/null +++ b/cncnet-api/resources/views/admin/irc/components/bans/bans-table.blade.php @@ -0,0 +1,40 @@ +
    + + + + + + + + + + + + + + + + + @foreach ($bans as $ban) + + + + + + + + + + + + + @endforeach + +
    UsernameIdentHostAdminChannel Global BanCreated AtExpires At Status
    {{ $ban->username }} {{ $ban->ident }} {{ $ban->host }} {{ \App\Models\User::find($ban->admin_id)->name }}{{ $ban->channel }}{{ $ban->global_ban ? 'Yes' : 'No' }}{{ $ban->created_at?->format('F j, Y, g:i a T') }}{{ $ban->expires_at?->format('F j, Y, g:i a T') ?? 'Never' }} + @if ($ban->expires_at?->isPast()) +
    Expired
    + @else +
    Active
    + @endif +
    View Ban
    +
    diff --git a/cncnet-api/resources/views/admin/irc/components/warnings/warning-expire-form.blade.php b/cncnet-api/resources/views/admin/irc/components/warnings/warning-expire-form.blade.php new file mode 100644 index 00000000..eb0a44d7 --- /dev/null +++ b/cncnet-api/resources/views/admin/irc/components/warnings/warning-expire-form.blade.php @@ -0,0 +1,5 @@ +
    + @csrf + + +
    diff --git a/cncnet-api/resources/views/admin/irc/components/warnings/warning-form.blade.php b/cncnet-api/resources/views/admin/irc/components/warnings/warning-form.blade.php new file mode 100644 index 00000000..beca908e --- /dev/null +++ b/cncnet-api/resources/views/admin/irc/components/warnings/warning-form.blade.php @@ -0,0 +1,54 @@ +
    + + @if ($warning) + + @endif + + @csrf +

    + You must enter at least one value for User or Ident. +

    + +
    + Username + + + + Ident + + +
    + +
    +

    + Warning messages will automatically be prefixed with this message:
    "This is an official warning from CnCNet. Please read the + community guidelines and rules. https://cncnet.org/community-guidelines-and-rules - Reason for warning: (Reason Here)" +

    + Keep your warning reason short. + +
    + +
    + + +
    + + @if (count($errors) > 0) +
    +
      + @foreach ($errors->all() as $error) +
    • {{ $error }}
    • + @endforeach +
    +
    + @endif + + +
    diff --git a/cncnet-api/resources/views/admin/irc/components/warnings/warnings-table.blade.php b/cncnet-api/resources/views/admin/irc/components/warnings/warnings-table.blade.php new file mode 100644 index 00000000..5e582033 --- /dev/null +++ b/cncnet-api/resources/views/admin/irc/components/warnings/warnings-table.blade.php @@ -0,0 +1,42 @@ +
    + + + + + + + + + + + + + + + @foreach ($warnings as $warning) + + + + + + + + + + + @endforeach + +
    UsernameIdentAdminChannelCreated AtUser AknowledgedStatus
    {{ $warning->username }} {{ $warning->ident }} {{ \App\Models\User::find($warning->admin_id)->name }}{{ $warning->channel }}{{ $warning->created_at?->format('F j, Y, g:i a T') }} + @if ($warning->acknowledged) +
    Yes
    + @else +
    No
    + @endif +
    + @if ($warning->expired) +
    Expired
    + @else +
    Active
    + @endif +
    View warning
    +
    diff --git a/cncnet-api/resources/views/admin/irc/create.blade.php b/cncnet-api/resources/views/admin/irc/create.blade.php new file mode 100644 index 00000000..235fb7c3 --- /dev/null +++ b/cncnet-api/resources/views/admin/irc/create.blade.php @@ -0,0 +1,77 @@ +@extends('layouts.app') +@section('title', 'Ladder') + +@section('feature') + + CnCNet IRC Management + + CnCNet IRC Management + + + + +@endsection + +@section('breadcrumb') + +@endsection + +@section('content') +
    +
    + +
    + +
    + +
    +
    +

    Create new ban

    + + + + @include('admin.irc.components.bans.ban-form', ['ban' => null]) +
    +
    +
    +
    +@endsection diff --git a/cncnet-api/resources/views/admin/irc/edit.blade.php b/cncnet-api/resources/views/admin/irc/edit.blade.php new file mode 100644 index 00000000..11b200b1 --- /dev/null +++ b/cncnet-api/resources/views/admin/irc/edit.blade.php @@ -0,0 +1,128 @@ +@extends('layouts.app') +@section('title', 'Ladder') + +@section('feature') + + CnCNet IRC Management + + CnCNet IRC Management + + + + +@endsection + +@section('breadcrumb') + +@endsection + +@section('content') +
    +
    + + @if (session('status')) +
    + {{ session('status') }} +
    + @endif + +
    + +
    + +
    +
    + +

    Ban Details

    + + @if ($ban->expires_at != null) +

    This ban was originally set to expire: {{ $ban->ban_original_expiry ?? 'Never' }}

    +

    + @if ($ban->ban_original_expiry) + Original Ban Length: + {{ round($ban->created_at->diffInDays($ban->ban_original_expiry)) }} days +
    + @endif + Updated Ban Length: {{ round($ban->created_at->diffInDays($ban->expires_at)) }} day +

    + + @if ($ban->expires_at?->isPast()) +
    Note: This ban has now expired

    + @endif + @else +

    This ban is permanent and not set to expire.

    + @endif + +
    + @include('admin.irc.components.bans.ban-expire-form', ['ban' => $ban]) +
    + +

    Edit ban

    + @include('admin.irc.components.bans.ban-form', ['ban' => $ban]) + +
    +

    Ban Change History

    +
    + + + + + + + + + + @foreach ($ban->logs as $log) + + + + + + @endforeach + +
    ActionAdminWhen
    {{ $log->action }}{{ \App\Models\User::find($log->admin_id)->name }}{{ $log->created_at->format('F j, Y, g:i a T') }}
    +
    +
    +
    +
    +
    +
    +@endsection diff --git a/cncnet-api/resources/views/admin/irc/index.blade.php b/cncnet-api/resources/views/admin/irc/index.blade.php new file mode 100644 index 00000000..c255c79b --- /dev/null +++ b/cncnet-api/resources/views/admin/irc/index.blade.php @@ -0,0 +1,100 @@ +@extends('layouts.app') +@section('title', 'Ladder') + +@section('feature') + + CnCNet IRC Management + + CnCNet IRC Management + + + + +@endsection + +@section('breadcrumb') + +@endsection + +@section('content') +
    +
    + +

    IRC Manager

    +

    Manage user IRC bans.

    + + + + +
    +
    +
    +

    Recent IRC warnings

    +

    Showing the latest warnings.

    + + + + @include('admin.irc.components.warnings.warnings-table') +
    +
    +
    + +
    +
    +
    +

    Recent IRC bans

    +

    Showing the latest bans.

    + + + + @include('admin.irc.components.bans.bans-table') +
    +
    +
    +
    +
    +@endsection diff --git a/cncnet-api/resources/views/admin/irc/warning-create.blade.php b/cncnet-api/resources/views/admin/irc/warning-create.blade.php new file mode 100644 index 00000000..988f7c85 --- /dev/null +++ b/cncnet-api/resources/views/admin/irc/warning-create.blade.php @@ -0,0 +1,74 @@ +@extends('layouts.app') +@section('title', 'Ladder') + +@section('feature') + + CnCNet IRC Management + + CnCNet IRC Management + + + + +@endsection + +@section('breadcrumb') + +@endsection + +@section('content') +
    +
    + + + +
    +
    +

    Create new warning

    + + @include('admin.irc.components.warnings.warning-form', ['warning' => null]) +
    +
    +
    +
    +@endsection diff --git a/cncnet-api/resources/views/admin/irc/warning-edit.blade.php b/cncnet-api/resources/views/admin/irc/warning-edit.blade.php new file mode 100644 index 00000000..9146ff09 --- /dev/null +++ b/cncnet-api/resources/views/admin/irc/warning-edit.blade.php @@ -0,0 +1,87 @@ +@extends('layouts.app') +@section('title', 'Ladder') + +@section('feature') + + CnCNet IRC Management + + CnCNet IRC Management + + + + +@endsection + +@section('breadcrumb') + +@endsection + +@section('content') +
    +
    + + @if (session('status')) +
    + {{ session('status') }} +
    + @endif + + + +
    +
    + +

    Warning Details

    + +
    + @include('admin.irc.components.warnings.warning-expire-form', ['warning' => $warning]) +
    + +

    View warning

    + @include('admin.irc.components.warnings.warning-form', ['warning' => $warning]) + +
    +
    +
    +
    +@endsection diff --git a/cncnet-api/resources/views/admin/irc/warnings.blade.php b/cncnet-api/resources/views/admin/irc/warnings.blade.php new file mode 100644 index 00000000..980f23ea --- /dev/null +++ b/cncnet-api/resources/views/admin/irc/warnings.blade.php @@ -0,0 +1,89 @@ +@extends('layouts.app') +@section('title', 'Ladder') + +@section('feature') + + CnCNet IRC Warnings + + Manage all IRC Warnings + + + + +@endsection + +@section('breadcrumb') + +@endsection + +@section('content') +
    +
    + +
    + + +
    + {{ $warnings->links() }} + + @include('admin.irc.components.warnings.warnings-table') + + {{ $warnings->links() }} +
    +
    +
    +
    +@endsection diff --git a/cncnet-api/resources/views/layouts/app.blade.php b/cncnet-api/resources/views/layouts/app.blade.php index 123fa433..521e9f27 100755 --- a/cncnet-api/resources/views/layouts/app.blade.php +++ b/cncnet-api/resources/views/layouts/app.blade.php @@ -66,13 +66,14 @@ @yield('feature')
    -
    -

    Love playing C&C online? CnCNet relies on donations to keep running.

    -
    - Donate via Open Collective + @if(!Auth::user()?->isAdmin()) +
    +

    Love playing C&C online? CnCNet relies on donations to keep running.

    +
    -
    - + @endif @yield('content') @yield('breadcrumb')
    diff --git a/cncnet-api/routes/api.php b/cncnet-api/routes/api.php index f70f3d86..1b1b24d7 100644 --- a/cncnet-api/routes/api.php +++ b/cncnet-api/routes/api.php @@ -125,6 +125,8 @@ Route::group(['prefix' => 'v2'], function () { Route::get("/bans", [\App\Http\Controllers\Api\V2\Bans\ApiBanController::class, 'getBans']); + Route::get("/warnings", [\App\Http\Controllers\Api\V2\Bans\ApiBanController::class, 'getWarnings']); + Route::post("/warnings/receive", [\App\Http\Controllers\Api\V2\Bans\ApiBanController::class, 'receiveWarningAcknowledgments']); Route::get("/events", [\App\Http\Controllers\Api\V2\Events\ApiEventController::class, 'getEvents']); Route::group(['middleware' => 'jwt.auth'], function () diff --git a/cncnet-api/routes/web.php b/cncnet-api/routes/web.php index e4c48dcb..82ec41bb 100644 --- a/cncnet-api/routes/web.php +++ b/cncnet-api/routes/web.php @@ -74,7 +74,6 @@ Route::group(['middleware' => 'restrict:canEditAnyLadders'], function () { - Route::get('podium', [\App\Http\Controllers\Admin\PodiumController::class, 'getPodiumForm'])->name('admin.podium'); Route::get('podium/compute', [\App\Http\Controllers\Admin\PodiumController::class, 'computePodium'])->name('admin.podium.compute'); @@ -84,7 +83,6 @@ Route::group(['middleware' => 'restrict:adminRequired'], function () { - Route::get('users/', [\App\Http\Controllers\AdminController::class, 'getManageUsersIndex']); Route::get('users/chatbans', [\App\Http\Controllers\AdminController::class, 'getChatBannedUsers']); Route::get('users/edit/{userId}', [\App\Http\Controllers\AdminController::class, 'getEditUser']); @@ -95,9 +93,26 @@ Route::post('clans', [\App\Http\Controllers\AdminController::class, 'updateClan']); }); - Route::group(['prefix' => 'news', 'middleware' => ['restrict:adminRequired', 'restrict:isNewsAdmin']], function () + Route::group(['prefix' => 'irc', 'middleware' => ['restrict:adminRequired']], function () { + Route::get('/', [\App\Http\Controllers\Admin\IrcBanController::class, 'getBanIndex'])->name("admin.irc"); + Route::get('/bans', [\App\Http\Controllers\Admin\IrcBanController::class, 'getAllBans'])->name("admin.irc.bans"); + Route::get('/bans/create', [\App\Http\Controllers\Admin\IrcBanController::class, 'getCreateBan'])->name("admin.irc.bans.create"); + Route::get('/bans/edit/{id}', [\App\Http\Controllers\Admin\IrcBanController::class, 'getEditBan'])->name("admin.irc.bans.edit"); + Route::post('/bans/update', [\App\Http\Controllers\Admin\IrcBanController::class, 'updateBan'])->name("admin.irc.bans.update"); + Route::post('/bans/expire', [\App\Http\Controllers\Admin\IrcBanController::class, 'expireBan'])->name("admin.irc.bans.expire"); + Route::post('/bans/create', [\App\Http\Controllers\Admin\IrcBanController::class, 'createBan'])->name("admin.irc.bans.create"); + + Route::get('/warnings', [\App\Http\Controllers\Admin\IrcWarningController::class, 'getAllWarnings'])->name("admin.irc.warnings"); + Route::get('/warnings/create', [\App\Http\Controllers\Admin\IrcWarningController::class, 'getCreateWarning'])->name("admin.irc.warnings.create"); + Route::get('/warnings/edit/{id}', [\App\Http\Controllers\Admin\IrcWarningController::class, 'getEditWarning'])->name("admin.irc.warnings.edit"); + Route::post('/warnings/create', [\App\Http\Controllers\Admin\IrcWarningController::class, 'createWarning'])->name("admin.irc.warnings.create"); + Route::post('/warnings/{id}/expire', [\App\Http\Controllers\Admin\IrcWarningController::class, 'expireWarning'])->name("admin.irc.warnings.expire"); + Route::post('/warnings/update', [\App\Http\Controllers\Admin\IrcWarningController::class, 'updateWarning'])->name("admin.irc.warnings.update"); + }); + Route::group(['prefix' => 'news', 'middleware' => ['restrict:adminRequired', 'restrict:isNewsAdmin']], function () + { Route::get('/', [\App\Http\Controllers\AdminNewsController::class, 'getIndex']); Route::get('/create', [\App\Http\Controllers\AdminNewsController::class, 'getCreate']); Route::get('/edit/{id}', [\App\Http\Controllers\AdminNewsController::class, 'getEdit']); diff --git a/docker-compose.yml b/docker-compose.yml index 98f28826..ca6b781f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -41,7 +41,7 @@ services: command: --max_connections=1000 --max_allowed_packet=128M --log_warnings=3 --wait_timeout=31536000 --slow-query-log --interactive_timeout=31536000 volumes: - cncnet-ladder-db:/var/lib/mysql - - ./docker/mysql/init.sql:/docker-entrypoint-initdb.d/init.sql # Import latest db tables on init + - ./docker/mysql/init.sql:/docker-entrypoint-initdb.d/init.sql # Import latest db tables if we haven't a database yet # https://medium.com/@kauminikg/how-to-increase-max-connections-in-mysql-docker-container-772ae17e3526 ulimits: nofile: diff --git a/docker/Dockerfile b/docker/Dockerfile index f2edde58..ce137e07 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -86,14 +86,17 @@ RUN docker-php-ext-install gd && \ RUN if [ "$debug" = 1 ] ; then \ pecl install xdebug-3.3.0 && \ docker-php-ext-enable xdebug; \ -fi + fi ##################################### # PHP Memcached: ##################################### -# Install the php memcached extension -RUN pecl install memcached && docker-php-ext-enable memcached +# Install the php memcached extension for prod only +RUN if [ "$debug" = 0 ] ; then \ + pecl install memcached && \ + docker-php-ext-enable memcached; \ + fi ##################################### # PHP OPCache: @@ -103,7 +106,7 @@ RUN pecl install memcached && docker-php-ext-enable memcached RUN if [ "$debug" = 0 ] ; then \ docker-php-ext-install opcache && \ docker-php-ext-enable opcache; \ -fi + fi COPY docker/php/conf.d/opcache.ini /usr/local/etc/php/conf.d/opcache.ini # Install Composer diff --git a/docker/mysql/init.sql b/docker/mysql/init.sql index f2229834..2d02028f 100644 --- a/docker/mysql/init.sql +++ b/docker/mysql/init.sql @@ -1,2284 +1,2 @@ --- phpMyAdmin SQL Dump --- version 5.2.0 --- https://www.phpmyadmin.net/ --- --- Host: mysql --- Generation Time: Apr 02, 2023 at 10:14 AM --- Server version: 10.10.2-MariaDB-1:10.10.2+maria~ubu2204 --- PHP Version: 8.0.27 - -SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; -START TRANSACTION; -SET time_zone = "+00:00"; - - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8mb4 */; - --- --- Database: `cncnet_api` --- - --- -------------------------------------------------------- - --- --- Table structure for table `achievements` --- - -CREATE TABLE `achievements` ( - `id` int(10) UNSIGNED NOT NULL, - `achievement_type` enum('IMMEDIATE','CAREER','MULTI') NOT NULL, - `order` int(11) NOT NULL DEFAULT 999, - `tag` text DEFAULT NULL, - `ladder_id` int(10) UNSIGNED NOT NULL, - `achievement_name` text NOT NULL, - `achievement_description` text NOT NULL, - `heap_name` text DEFAULT NULL, - `object_name` text DEFAULT NULL, - `cameo` text DEFAULT NULL, - `unlock_count` int(11) NOT NULL DEFAULT 0 -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `achievements_progress` --- - -CREATE TABLE `achievements_progress` ( - `id` int(10) UNSIGNED NOT NULL, - `achievement_id` int(10) UNSIGNED NOT NULL, - `user_id` int(10) UNSIGNED NOT NULL, - `achievement_unlocked_date` timestamp NULL DEFAULT NULL, - `count` int(11) NOT NULL DEFAULT 0, - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `bans` --- - -CREATE TABLE `bans` ( - `id` int(10) UNSIGNED NOT NULL, - `admin_id` int(10) UNSIGNED NOT NULL, - `user_id` int(10) UNSIGNED NOT NULL, - `ban_type` int(10) UNSIGNED NOT NULL, - `internal_note` text NOT NULL, - `plubic_reason` text NOT NULL, - `expires` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `ip_address_id` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `cards` --- - -CREATE TABLE `cards` ( - `id` int(10) UNSIGNED NOT NULL, - `name` varchar(255) NOT NULL, - `short` varchar(255) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `clans` --- - -CREATE TABLE `clans` ( - `id` int(10) UNSIGNED NOT NULL, - `ladder_id` int(11) NOT NULL, - `short` text NOT NULL, - `name` text NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `clan_invitations` --- - -CREATE TABLE `clan_invitations` ( - `id` int(10) UNSIGNED NOT NULL, - `clan_id` int(11) NOT NULL, - `author_id` int(11) NOT NULL, - `player_id` int(11) NOT NULL, - `type` enum('invited','cancelled','joined','kicked','left','promoted','demoted') NOT NULL, - `deleted_at` timestamp NULL DEFAULT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `clan_players` --- - -CREATE TABLE `clan_players` ( - `id` int(10) UNSIGNED NOT NULL, - `clan_id` int(11) NOT NULL, - `player_id` int(11) NOT NULL, - `clan_role_id` int(11) NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `clan_roles` --- - -CREATE TABLE `clan_roles` ( - `id` int(10) UNSIGNED NOT NULL, - `value` text NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `client_version` --- - -CREATE TABLE `client_version` ( - `version` varchar(255) NOT NULL, - `link` varchar(255) NOT NULL, - `format` varchar(255) NOT NULL, - `name` varchar(255) NOT NULL, - `platform` varchar(255) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `countable_game_objects` --- - -CREATE TABLE `countable_game_objects` ( - `id` int(10) UNSIGNED NOT NULL, - `heap_name` char(3) NOT NULL, - `heap_id` int(11) NOT NULL, - `name` varchar(255) NOT NULL, - `cameo` varchar(255) NOT NULL, - `cost` int(11) NOT NULL, - `value` int(11) NOT NULL, - `ui_name` varchar(255) NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `game_object_schema_id` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `countable_object_heaps` --- - -CREATE TABLE `countable_object_heaps` ( - `id` int(10) UNSIGNED NOT NULL, - `name` varchar(255) NOT NULL, - `description` varchar(255) NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `email_verifications` --- - -CREATE TABLE `email_verifications` ( - `id` int(10) UNSIGNED NOT NULL, - `user_id` int(10) UNSIGNED NOT NULL, - `token` varchar(255) NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `games` --- - -CREATE TABLE `games` ( - `id` int(10) UNSIGNED NOT NULL, - `ladder_history_id` int(10) UNSIGNED NOT NULL, - `wol_game_id` int(11) UNSIGNED NOT NULL, - `bamr` int(11) NOT NULL DEFAULT 1, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `crat` int(11) NOT NULL, - `cred` longtext NOT NULL, - `shrt` int(11) NOT NULL, - `supr` int(11) NOT NULL, - `unit` int(11) NOT NULL, - `plrs` int(11) NOT NULL, - `scen` varchar(255) DEFAULT NULL, - `hash` varchar(255) DEFAULT NULL, - `game_report_id` int(10) UNSIGNED DEFAULT NULL, - `qm_match_id` int(10) UNSIGNED DEFAULT NULL, - `game_type` int(10) UNSIGNED DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci ROW_FORMAT=COMPACT; - --- -------------------------------------------------------- - --- --- Table structure for table `games_backup` --- - -CREATE TABLE `games_backup` ( - `id` int(10) UNSIGNED NOT NULL, - `ladder_history_id` int(10) UNSIGNED NOT NULL, - `wol_game_id` int(10) UNSIGNED NOT NULL, - `afps` int(11) NOT NULL, - `oosy` tinyint(1) NOT NULL, - `bamr` int(11) NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `crat` int(11) NOT NULL, - `dura` longtext NOT NULL, - `cred` longtext NOT NULL, - `shrt` int(11) NOT NULL, - `supr` int(11) NOT NULL, - `unit` int(11) NOT NULL, - `plrs` int(11) NOT NULL, - `scen` varchar(255) NOT NULL, - `hash` varchar(255) NOT NULL, - `sdfx` tinyint(1) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `games_raw` --- - -CREATE TABLE `games_raw` ( - `id` int(10) UNSIGNED NOT NULL, - `hash` varchar(255) NOT NULL, - `packet` longtext NOT NULL, - `game_id` int(10) UNSIGNED NOT NULL, - `ladder_id` int(10) UNSIGNED NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci ROW_FORMAT=COMPACT; - --- -------------------------------------------------------- - --- --- Table structure for table `game_audit` --- - -CREATE TABLE `game_audit` ( - `id` int(10) UNSIGNED NOT NULL, - `game_id` int(10) UNSIGNED NOT NULL, - `ladder_history_id` int(10) UNSIGNED NOT NULL, - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - `username` varchar(255) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `game_object_counts` --- - -CREATE TABLE `game_object_counts` ( - `stats_id` int(10) UNSIGNED NOT NULL, - `countable_game_objects_id` int(10) UNSIGNED NOT NULL, - `count` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `game_object_schemas` --- - -CREATE TABLE `game_object_schemas` ( - `id` int(10) UNSIGNED NOT NULL, - `name` text NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `game_reports` --- - -CREATE TABLE `game_reports` ( - `id` int(10) UNSIGNED NOT NULL, - `game_id` int(10) UNSIGNED NOT NULL, - `player_id` int(10) UNSIGNED NOT NULL, - `best_report` tinyint(1) NOT NULL, - `manual_report` tinyint(1) NOT NULL, - `duration` int(11) NOT NULL, - `valid` tinyint(1) NOT NULL, - `finished` tinyint(1) NOT NULL, - `fps` int(11) NOT NULL, - `oos` tinyint(1) NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `pings_sent` int(11) NOT NULL DEFAULT 0, - `pings_received` int(11) NOT NULL DEFAULT 0 -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `game_stats` --- - -CREATE TABLE `game_stats` ( - `id` int(11) NOT NULL, - `game_id` int(10) UNSIGNED NOT NULL COMMENT 'Game Id', - `player_id` int(11) UNSIGNED NOT NULL, - `stats_id` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci ROW_FORMAT=COMPACT; - --- -------------------------------------------------------- - --- --- Table structure for table `ip_addresses` --- - -CREATE TABLE `ip_addresses` ( - `id` int(10) UNSIGNED NOT NULL, - `address` varchar(255) NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `city` varchar(255) NOT NULL, - `country` varchar(255) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `ip_address_histories` --- - -CREATE TABLE `ip_address_histories` ( - `id` int(10) UNSIGNED NOT NULL, - `user_id` int(11) NOT NULL, - `ip_address_id` int(11) NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `irc_associations` --- - -CREATE TABLE `irc_associations` ( - `id` int(10) UNSIGNED NOT NULL, - `irc_hostmask_id` int(11) NOT NULL, - `user_id` int(11) NOT NULL, - `ladder_id` int(11) NOT NULL, - `player_id` int(11) NOT NULL, - `clan_id` int(11) NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `refreshed_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `irc_hostmasks` --- - -CREATE TABLE `irc_hostmasks` ( - `id` int(10) UNSIGNED NOT NULL, - `value` text NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `irc_players` --- - -CREATE TABLE `irc_players` ( - `id` int(10) UNSIGNED NOT NULL, - `player_id` int(11) NOT NULL, - `ladder_id` int(11) NOT NULL, - `username` text NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `jobs` --- - -CREATE TABLE `jobs` ( - `id` bigint(20) UNSIGNED NOT NULL, - `queue` varchar(255) NOT NULL, - `payload` text NOT NULL, - `attempts` tinyint(3) UNSIGNED NOT NULL, - `reserved` tinyint(3) UNSIGNED NOT NULL, - `reserved_at` int(10) UNSIGNED DEFAULT NULL, - `available_at` int(10) UNSIGNED NOT NULL, - `created_at` int(10) UNSIGNED NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `ladders` --- - -CREATE TABLE `ladders` ( - `id` int(10) UNSIGNED NOT NULL, - `name` varchar(255) NOT NULL, - `abbreviation` varchar(255) NOT NULL, - `game` enum('ra','ts','yr') DEFAULT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `clans_allowed` tinyint(1) NOT NULL DEFAULT 0, - `game_object_schema_id` int(11) NOT NULL, - `map_pool_id` int(11) DEFAULT NULL, - `private` tinyint(1) NOT NULL DEFAULT 0, - `order` int(10) UNSIGNED NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci ROW_FORMAT=COMPACT; - --- -------------------------------------------------------- - --- --- Table structure for table `ladder_admins` --- - -CREATE TABLE `ladder_admins` ( - `id` int(10) UNSIGNED NOT NULL, - `ladder_id` int(10) UNSIGNED NOT NULL, - `user_id` int(10) UNSIGNED NOT NULL, - `admin` tinyint(1) NOT NULL, - `moderator` tinyint(1) NOT NULL, - `tester` tinyint(1) NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `ladder_alerts` --- - -CREATE TABLE `ladder_alerts` ( - `id` int(10) UNSIGNED NOT NULL, - `ladder_id` int(11) NOT NULL, - `message` text NOT NULL, - `expires_at` timestamp NULL DEFAULT NULL, - `deleted_at` timestamp NULL DEFAULT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `ladder_alert_players` --- - -CREATE TABLE `ladder_alert_players` ( - `id` int(10) UNSIGNED NOT NULL, - `player_id` int(11) NOT NULL, - `ladder_alert_id` int(11) NOT NULL, - `show` tinyint(1) NOT NULL DEFAULT 1, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `ladder_games` --- - -CREATE TABLE `ladder_games` ( - `id` int(10) UNSIGNED NOT NULL, - `game_id` int(10) UNSIGNED NOT NULL, - `ladder_history_id` int(10) UNSIGNED NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci ROW_FORMAT=COMPACT; - --- -------------------------------------------------------- - --- --- Table structure for table `ladder_history` --- - -CREATE TABLE `ladder_history` ( - `id` int(10) UNSIGNED NOT NULL, - `ladder_id` int(11) NOT NULL, - `starts` datetime NOT NULL, - `ends` datetime NOT NULL, - `short` varchar(255) NOT NULL, - `deleted_at` timestamp NULL DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `ladder_types` --- - -CREATE TABLE `ladder_types` ( - `id` int(10) UNSIGNED NOT NULL, - `name` varchar(255) NOT NULL, - `type` enum('player','clan') NOT NULL, - `match` enum('1vs1','2vs2','3vs3','4vs4') NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `league_players` --- - -CREATE TABLE `league_players` ( - `id` int(10) UNSIGNED NOT NULL, - `user_id` int(10) UNSIGNED NOT NULL, - `ladder_id` int(10) UNSIGNED NOT NULL, - `can_play_both_tiers` tinyint(1) NOT NULL DEFAULT 1, - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `maps` --- - -CREATE TABLE `maps` ( - `id` int(11) NOT NULL, - `hash` varchar(255) DEFAULT NULL, - `name` varchar(255) DEFAULT NULL, - `ladder_id` int(11) DEFAULT NULL, - `spawn_count` int(11) NOT NULL DEFAULT 2 -) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT; - --- -------------------------------------------------------- - --- --- Table structure for table `maps_backup` --- - -CREATE TABLE `maps_backup` ( - `id` int(11) NOT NULL, - `hash` varchar(255) DEFAULT NULL, - `name` varchar(255) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `map_headers` --- - -CREATE TABLE `map_headers` ( - `id` int(10) UNSIGNED NOT NULL, - `width` int(11) NOT NULL, - `height` int(11) NOT NULL, - `startX` int(11) NOT NULL, - `startY` int(11) NOT NULL, - `numStartingPoints` int(11) NOT NULL, - `map_id` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `map_pools` --- - -CREATE TABLE `map_pools` ( - `id` int(10) UNSIGNED NOT NULL, - `name` text NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `ladder_id` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `map_side_strings` --- - -CREATE TABLE `map_side_strings` ( - `id` int(10) UNSIGNED NOT NULL, - `value` blob NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `map_waypoints` --- - -CREATE TABLE `map_waypoints` ( - `id` int(10) UNSIGNED NOT NULL, - `bit_idx` int(10) UNSIGNED NOT NULL, - `x` int(10) UNSIGNED NOT NULL, - `y` int(10) UNSIGNED NOT NULL, - `map_header_id` int(10) UNSIGNED NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `migrations` --- - -CREATE TABLE `migrations` ( - `migration` varchar(255) NOT NULL, - `batch` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci ROW_FORMAT=COMPACT; - --- -------------------------------------------------------- - --- --- Table structure for table `object_schema_managers` --- - -CREATE TABLE `object_schema_managers` ( - `id` int(10) UNSIGNED NOT NULL, - `game_object_schema_id` int(11) NOT NULL, - `user_id` int(11) NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `password_resets` --- - -CREATE TABLE `password_resets` ( - `email` varchar(255) NOT NULL, - `token` varchar(255) NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci ROW_FORMAT=COMPACT; - --- -------------------------------------------------------- - --- --- Table structure for table `players` --- - -CREATE TABLE `players` ( - `id` int(10) UNSIGNED NOT NULL, - `user_id` int(10) UNSIGNED NOT NULL, - `username` varchar(255) NOT NULL, - `ladder_id` int(10) UNSIGNED NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `card_id` int(10) UNSIGNED NOT NULL, - `is_bot` tinyint(1) NOT NULL DEFAULT 0 -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci ROW_FORMAT=COMPACT; - --- -------------------------------------------------------- - --- --- Table structure for table `player_active_handles` --- - -CREATE TABLE `player_active_handles` ( - `id` int(10) UNSIGNED NOT NULL, - `ladder_id` int(11) NOT NULL, - `player_id` int(11) NOT NULL, - `user_id` int(11) NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `player_alerts` --- - -CREATE TABLE `player_alerts` ( - `id` int(10) UNSIGNED NOT NULL, - `player_id` int(11) NOT NULL, - `message` text NOT NULL, - `expires_at` timestamp NULL DEFAULT NULL, - `seen_at` timestamp NULL DEFAULT NULL, - `deleted_at` timestamp NULL DEFAULT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `player_caches` --- - -CREATE TABLE `player_caches` ( - `id` int(10) UNSIGNED NOT NULL, - `ladder_history_id` int(10) UNSIGNED NOT NULL, - `player_id` int(10) UNSIGNED NOT NULL, - `player_name` varchar(255) NOT NULL, - `card` int(11) DEFAULT NULL, - `points` int(11) NOT NULL, - `wins` int(11) NOT NULL, - `games` int(11) NOT NULL, - `percentile` int(11) NOT NULL, - `side` int(11) DEFAULT NULL, - `fps` int(11) NOT NULL, - `country` int(11) DEFAULT NULL, - `tier` int(11) NOT NULL DEFAULT 1 -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `player_cache_updates` --- - -CREATE TABLE `player_cache_updates` ( - `id` int(10) UNSIGNED NOT NULL, - `player_cache_id` int(11) NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `player_data_strings` --- - -CREATE TABLE `player_data_strings` ( - `id` int(10) UNSIGNED NOT NULL, - `value` varchar(255) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `player_games` --- - -CREATE TABLE `player_games` ( - `id` int(10) UNSIGNED NOT NULL, - `game_id` int(10) UNSIGNED NOT NULL, - `player_id` int(10) UNSIGNED NOT NULL, - `opponent_id` int(11) DEFAULT NULL, - `result` int(11) NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci ROW_FORMAT=COMPACT; - --- -------------------------------------------------------- - --- --- Table structure for table `player_game_reports` --- - -CREATE TABLE `player_game_reports` ( - `id` int(10) UNSIGNED NOT NULL, - `game_id` int(10) UNSIGNED NOT NULL, - `game_report_id` int(10) UNSIGNED NOT NULL, - `player_id` int(10) UNSIGNED NOT NULL, - `local_id` int(11) NOT NULL, - `local_team_id` int(11) NOT NULL, - `points` int(11) NOT NULL DEFAULT 0, - `stats_id` int(11) DEFAULT NULL, - `disconnected` tinyint(1) NOT NULL DEFAULT 0, - `no_completion` tinyint(1) NOT NULL DEFAULT 0, - `quit` tinyint(1) NOT NULL DEFAULT 0, - `won` tinyint(1) NOT NULL DEFAULT 0, - `defeated` tinyint(1) NOT NULL DEFAULT 0, - `draw` tinyint(1) NOT NULL DEFAULT 0, - `spectator` tinyint(1) NOT NULL DEFAULT 0, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `backupPts` int(11) NOT NULL DEFAULT 0, - `spawn` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `player_histories` --- - -CREATE TABLE `player_histories` ( - `id` int(10) UNSIGNED NOT NULL, - `player_id` int(10) UNSIGNED NOT NULL, - `ladder_history_id` int(10) UNSIGNED NOT NULL, - `tier` int(11) NOT NULL DEFAULT 1, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `cancels` int(11) NOT NULL DEFAULT 0 -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `player_points` --- - -CREATE TABLE `player_points` ( - `id` int(10) UNSIGNED NOT NULL, - `points_awarded` int(11) NOT NULL, - `game_won` tinyint(1) NOT NULL, - `game_id` int(10) UNSIGNED NOT NULL, - `player_id` int(10) UNSIGNED NOT NULL, - `ladder_history_id` int(10) UNSIGNED NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci ROW_FORMAT=COMPACT; - --- -------------------------------------------------------- - --- --- Table structure for table `player_ratings` --- - -CREATE TABLE `player_ratings` ( - `id` int(10) UNSIGNED NOT NULL, - `player_id` int(11) NOT NULL, - `rating` int(11) NOT NULL, - `peak_rating` int(11) NOT NULL, - `rated_games` int(11) NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `qm_canceled_matches` --- - -CREATE TABLE `qm_canceled_matches` ( - `id` int(10) UNSIGNED NOT NULL, - `qm_match_id` bigint(20) UNSIGNED NOT NULL, - `player_id` int(10) UNSIGNED NOT NULL, - `ladder_id` int(10) UNSIGNED NOT NULL, - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `qm_connection_stats` --- - -CREATE TABLE `qm_connection_stats` ( - `id` int(10) UNSIGNED NOT NULL, - `qm_match_id` int(11) NOT NULL, - `player_id` int(11) NOT NULL, - `peer_id` int(11) NOT NULL, - `ip_address_id` int(11) NOT NULL, - `port` int(11) NOT NULL, - `rtt` int(11) NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `qm_ladder_rules` --- - -CREATE TABLE `qm_ladder_rules` ( - `id` int(10) UNSIGNED NOT NULL, - `ladder_id` int(11) NOT NULL, - `player_count` int(11) NOT NULL, - `map_vetoes` int(11) NOT NULL, - `max_difference` int(11) NOT NULL, - `all_sides` varchar(255) NOT NULL, - `allowed_sides` varchar(255) NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `bail_time` int(11) NOT NULL DEFAULT 60, - `bail_fps` int(11) NOT NULL DEFAULT 30, - `tier2_rating` int(11) NOT NULL DEFAULT 0, - `rating_per_second` double NOT NULL, - `max_points_difference` int(11) NOT NULL, - `points_per_second` double NOT NULL, - `use_elo_points` tinyint(1) NOT NULL DEFAULT 1, - `wol_k` int(11) NOT NULL DEFAULT 64, - `show_map_preview` tinyint(1) NOT NULL DEFAULT 1, - `reduce_map_repeats` int(11) NOT NULL DEFAULT 0, - `ladder_rules_message` text NOT NULL, - `ladder_discord` varchar(255) NOT NULL, - `point_filter_rank_threshold` int(11) NOT NULL DEFAULT 50 -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `qm_maps` --- - -CREATE TABLE `qm_maps` ( - `id` int(10) UNSIGNED NOT NULL, - `ladder_id` int(11) NOT NULL, - `map_id` int(11) NOT NULL, - `description` varchar(255) NOT NULL, - `bit_idx` int(11) NOT NULL, - `valid` tinyint(1) NOT NULL, - `spawn_order` varchar(255) NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `team1_spawn_order` varchar(255) NOT NULL, - `team2_spawn_order` varchar(255) NOT NULL, - `allowed_sides` varchar(255) NOT NULL, - `admin_description` varchar(255) NOT NULL, - `map_pool_id` int(11) NOT NULL, - `rejectable` tinyint(1) NOT NULL DEFAULT 1, - `default_reject` tinyint(1) NOT NULL DEFAULT 0, - `random_spawns` tinyint(1) NOT NULL DEFAULT 0 -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `qm_maps_backup` --- - -CREATE TABLE `qm_maps_backup` ( - `id` int(10) UNSIGNED NOT NULL, - `ladder_id` int(11) NOT NULL, - `map_id` int(11) NOT NULL, - `description` varchar(255) NOT NULL, - `bit_idx` int(11) NOT NULL, - `valid` tinyint(1) NOT NULL, - `spawn_order` varchar(255) NOT NULL, - `speed` int(11) NOT NULL, - `credits` int(11) NOT NULL, - `bases` tinyint(1) NOT NULL, - `units` int(11) NOT NULL, - `tech` int(11) DEFAULT NULL, - `short_game` tinyint(1) DEFAULT NULL, - `fog` tinyint(1) DEFAULT NULL, - `redeploy` tinyint(1) DEFAULT NULL, - `crates` tinyint(1) DEFAULT NULL, - `multi_eng` tinyint(1) DEFAULT NULL, - `allies` tinyint(1) DEFAULT NULL, - `dog_kill` tinyint(1) DEFAULT NULL, - `bridges` tinyint(1) DEFAULT NULL, - `supers` tinyint(1) DEFAULT NULL, - `build_ally` tinyint(1) DEFAULT NULL, - `spawn_preview` tinyint(1) DEFAULT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `game_mode` varchar(255) DEFAULT NULL, - `multi_factory` tinyint(1) DEFAULT NULL, - `firestorm` tinyint(1) DEFAULT NULL, - `ra2_mode` tinyint(1) DEFAULT NULL, - `harv_truce` tinyint(1) DEFAULT NULL, - `aimable_sams` tinyint(1) DEFAULT NULL, - `attack_neutral` tinyint(1) DEFAULT NULL, - `fix_ai_ally` tinyint(1) DEFAULT NULL, - `ally_reveal` tinyint(1) DEFAULT NULL, - `am_fast_build` tinyint(1) DEFAULT NULL, - `parabombs` tinyint(1) DEFAULT NULL, - `fix_formation_speed` tinyint(1) DEFAULT NULL, - `fix_magic_build` tinyint(1) DEFAULT NULL, - `fix_range_exploit` tinyint(1) DEFAULT NULL, - `super_tesla_fix` tinyint(1) DEFAULT NULL, - `forced_alliances` tinyint(1) DEFAULT NULL, - `tech_center_fix` tinyint(1) DEFAULT NULL, - `no_screen_shake` tinyint(1) DEFAULT NULL, - `no_tesla_delay` tinyint(1) DEFAULT NULL, - `dead_player_radar` tinyint(1) DEFAULT NULL, - `capture_flag` tinyint(1) DEFAULT NULL, - `slow_unit_build` tinyint(1) DEFAULT NULL, - `shroud_regrows` tinyint(1) DEFAULT NULL, - `ai_player_count` tinyint(1) NOT NULL DEFAULT 0, - `team1_spawn_order` varchar(255) NOT NULL, - `team2_spawn_order` varchar(255) NOT NULL, - `aftermath` tinyint(1) DEFAULT NULL, - `ore_regenerates` tinyint(1) DEFAULT NULL, - `allowed_sides` varchar(255) NOT NULL, - `admin_description` varchar(255) NOT NULL, - `map_pool_id` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `qm_maps_old` --- - -CREATE TABLE `qm_maps_old` ( - `id` int(10) UNSIGNED NOT NULL, - `ladder_id` int(11) NOT NULL, - `map_id` int(11) NOT NULL, - `description` varchar(255) NOT NULL, - `bit_idx` int(11) NOT NULL, - `valid` tinyint(1) NOT NULL, - `spawn_affinity` varchar(255) NOT NULL, - `speed` int(11) NOT NULL, - `credits` int(11) NOT NULL, - `bases` tinyint(1) NOT NULL, - `units` int(11) NOT NULL, - `tech` int(11) NOT NULL, - `short_game` tinyint(1) NOT NULL, - `fog` tinyint(1) NOT NULL, - `redeploy` tinyint(1) NOT NULL, - `crates` tinyint(1) NOT NULL, - `multi_eng` tinyint(1) NOT NULL, - `allies` tinyint(1) NOT NULL, - `dog_kill` tinyint(1) NOT NULL, - `bridges` tinyint(1) NOT NULL, - `supers` tinyint(1) NOT NULL, - `build_ally` tinyint(1) NOT NULL, - `spawn_preview` tinyint(1) NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `qm_matches` --- - -CREATE TABLE `qm_matches` ( - `id` bigint(20) UNSIGNED NOT NULL, - `ladder_id` int(11) NOT NULL, - `qm_map_id` int(11) NOT NULL, - `seed` int(11) NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `game_id` int(10) UNSIGNED DEFAULT NULL, - `tier` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `qm_match_players` --- - -CREATE TABLE `qm_match_players` ( - `id` bigint(20) UNSIGNED NOT NULL, - `waiting` tinyint(1) NOT NULL, - `player_id` int(11) NOT NULL, - `ladder_id` int(11) NOT NULL, - `map_bitfield` int(11) NOT NULL, - `chosen_side` int(11) NOT NULL, - `actual_side` int(11) NOT NULL, - `port` int(11) DEFAULT NULL, - `color` int(11) DEFAULT NULL, - `location` int(11) DEFAULT NULL, - `qm_match_id` bigint(20) DEFAULT NULL, - `tunnel_id` int(11) DEFAULT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `ipv6_port` int(11) DEFAULT NULL, - `lan_port` int(11) DEFAULT NULL, - `ai_dat` tinyint(1) DEFAULT NULL, - `ip_address_id` int(10) UNSIGNED DEFAULT NULL, - `ipv6_address_id` int(10) UNSIGNED DEFAULT NULL, - `lan_address_id` int(10) UNSIGNED DEFAULT NULL, - `version_id` int(10) UNSIGNED DEFAULT NULL, - `platform_id` int(10) UNSIGNED DEFAULT NULL, - `map_sides_id` int(10) UNSIGNED DEFAULT NULL, - `ddraw_id` int(10) UNSIGNED DEFAULT NULL, - `tier` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `qm_match_states` --- - -CREATE TABLE `qm_match_states` ( - `id` int(10) UNSIGNED NOT NULL, - `player_id` int(10) UNSIGNED NOT NULL, - `qm_match_id` int(10) UNSIGNED NOT NULL, - `state_type_id` int(10) UNSIGNED NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `qm_queue_entries` --- - -CREATE TABLE `qm_queue_entries` ( - `id` int(10) UNSIGNED NOT NULL, - `qm_match_player_id` int(10) UNSIGNED NOT NULL, - `ladder_history_id` int(10) UNSIGNED NOT NULL, - `rating` int(11) NOT NULL, - `points` int(11) NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `game_type` int(10) UNSIGNED DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `sides` --- - -CREATE TABLE `sides` ( - `id` int(10) UNSIGNED NOT NULL, - `ladder_id` int(11) NOT NULL, - `local_id` int(11) NOT NULL, - `name` varchar(255) NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `spawn_options` --- - -CREATE TABLE `spawn_options` ( - `id` int(10) UNSIGNED NOT NULL, - `type_id` int(11) NOT NULL, - `name_id` int(11) NOT NULL, - `string1_id` int(11) NOT NULL, - `string2_id` int(11) NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `spawn_option_strings` --- - -CREATE TABLE `spawn_option_strings` ( - `id` int(10) UNSIGNED NOT NULL, - `string` text NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `spawn_option_types` --- - -CREATE TABLE `spawn_option_types` ( - `id` int(10) UNSIGNED NOT NULL, - `name` text NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `spawn_option_values` --- - -CREATE TABLE `spawn_option_values` ( - `id` int(10) UNSIGNED NOT NULL, - `qm_map_id` int(11) DEFAULT NULL, - `spawn_option_id` int(11) NOT NULL, - `value_id` int(11) NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `ladder_id` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `state_types` --- - -CREATE TABLE `state_types` ( - `id` int(10) UNSIGNED NOT NULL, - `name` varchar(255) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `stats2` --- - -CREATE TABLE `stats2` ( - `id` int(10) UNSIGNED NOT NULL, - `sid` int(11) DEFAULT NULL, - `col` int(11) DEFAULT NULL, - `cty` int(11) DEFAULT NULL, - `crd` int(11) DEFAULT NULL, - `hrv` int(11) DEFAULT NULL, - `player_game_report_id` int(10) UNSIGNED NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `tunnels` --- - -CREATE TABLE `tunnels` ( - `id` int(10) UNSIGNED NOT NULL, - `address` varchar(255) NOT NULL, - `country` varchar(255) NOT NULL, - `countrycode` varchar(255) NOT NULL, - `name` varchar(255) NOT NULL, - `password` int(11) NOT NULL, - `clients` int(11) NOT NULL, - `maxclients` int(11) NOT NULL, - `official` int(11) NOT NULL, - `heartbeat` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `latitude` int(11) NOT NULL, - `longitude` int(11) NOT NULL, - `version` int(11) NOT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `users` --- - -CREATE TABLE `users` ( - `id` int(10) UNSIGNED NOT NULL, - `name` varchar(255) NOT NULL, - `email` varchar(255) NOT NULL, - `password` varchar(60) NOT NULL, - `remember_token` varchar(100) DEFAULT NULL, - `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `group` enum('User','Moderator','Admin','God') NOT NULL DEFAULT 'User', - `ip_address_id` int(11) DEFAULT NULL, - `email_verified` tinyint(1) NOT NULL DEFAULT 0, - `avatar_path` varchar(255) DEFAULT NULL, - `avatar_upload_allowed` tinyint(1) NOT NULL DEFAULT 1, - `discord_profile` varchar(255) DEFAULT NULL, - `youtube_profile` varchar(255) DEFAULT NULL, - `twitch_profile` varchar(255) DEFAULT NULL, - `alias` varchar(255) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci ROW_FORMAT=COMPACT; - --- -------------------------------------------------------- - --- --- Table structure for table `user_ratings` --- - -CREATE TABLE `user_ratings` ( - `id` int(10) UNSIGNED NOT NULL, - `user_id` int(10) UNSIGNED NOT NULL, - `rating` int(11) NOT NULL, - `peak_rating` int(11) NOT NULL, - `rated_games` int(11) NOT NULL, - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `user_settings` --- - -CREATE TABLE `user_settings` ( - `id` int(10) UNSIGNED NOT NULL, - `user_id` int(10) UNSIGNED NOT NULL, - `enableAnonymous` tinyint(1) NOT NULL DEFAULT 0, - `disabledPointFilter` tinyint(1) NOT NULL DEFAULT 0 -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - --- --- Indexes for dumped tables --- - --- --- Indexes for table `achievements` --- -ALTER TABLE `achievements` - ADD PRIMARY KEY (`id`), - ADD KEY `achievements_ladder_id_foreign` (`ladder_id`); - --- --- Indexes for table `achievements_progress` --- -ALTER TABLE `achievements_progress` - ADD PRIMARY KEY (`id`), - ADD KEY `achievements_progress_achievement_id_foreign` (`achievement_id`), - ADD KEY `achievements_progress_user_id_foreign` (`user_id`); - --- --- Indexes for table `bans` --- -ALTER TABLE `bans` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `cards` --- -ALTER TABLE `cards` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `clans` --- -ALTER TABLE `clans` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `clan_invitations` --- -ALTER TABLE `clan_invitations` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `clan_players` --- -ALTER TABLE `clan_players` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `clan_roles` --- -ALTER TABLE `clan_roles` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `countable_game_objects` --- -ALTER TABLE `countable_game_objects` - ADD PRIMARY KEY (`id`), - ADD KEY `countable_game_objects_heap_name_name_index` (`heap_name`,`name`), - ADD KEY `countable_game_objects_heap_id_index` (`heap_id`); - --- --- Indexes for table `countable_object_heaps` --- -ALTER TABLE `countable_object_heaps` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `email_verifications` --- -ALTER TABLE `email_verifications` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `games` --- -ALTER TABLE `games` - ADD PRIMARY KEY (`id`) USING BTREE, - ADD KEY `games_game_report_id_index` (`game_report_id`); - --- --- Indexes for table `games_backup` --- -ALTER TABLE `games_backup` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `games_raw` --- -ALTER TABLE `games_raw` - ADD PRIMARY KEY (`id`) USING BTREE; - --- --- Indexes for table `game_audit` --- -ALTER TABLE `game_audit` - ADD PRIMARY KEY (`id`), - ADD KEY `game_audit_game_id_foreign` (`game_id`), - ADD KEY `game_audit_ladder_history_id_foreign` (`ladder_history_id`); - --- --- Indexes for table `game_object_counts` --- -ALTER TABLE `game_object_counts` - ADD KEY `game_object_counts_stats_id_index` (`stats_id`); - --- --- Indexes for table `game_object_schemas` --- -ALTER TABLE `game_object_schemas` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `game_reports` --- -ALTER TABLE `game_reports` - ADD PRIMARY KEY (`id`), - ADD KEY `game_reports_game_id_index` (`game_id`); - --- --- Indexes for table `game_stats` --- -ALTER TABLE `game_stats` - ADD PRIMARY KEY (`id`) USING BTREE, - ADD UNIQUE KEY `id` (`id`) USING BTREE, - ADD KEY `gid` (`game_id`) USING BTREE; - --- --- Indexes for table `ip_addresses` --- -ALTER TABLE `ip_addresses` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `ip_address_histories` --- -ALTER TABLE `ip_address_histories` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `irc_associations` --- -ALTER TABLE `irc_associations` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `irc_hostmasks` --- -ALTER TABLE `irc_hostmasks` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `irc_players` --- -ALTER TABLE `irc_players` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `jobs` --- -ALTER TABLE `jobs` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `ladders` --- -ALTER TABLE `ladders` - ADD PRIMARY KEY (`id`) USING BTREE; - --- --- Indexes for table `ladder_admins` --- -ALTER TABLE `ladder_admins` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `ladder_alerts` --- -ALTER TABLE `ladder_alerts` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `ladder_alert_players` --- -ALTER TABLE `ladder_alert_players` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `ladder_games` --- -ALTER TABLE `ladder_games` - ADD PRIMARY KEY (`id`) USING BTREE; - --- --- Indexes for table `ladder_history` --- -ALTER TABLE `ladder_history` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `ladder_types` --- -ALTER TABLE `ladder_types` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `league_players` --- -ALTER TABLE `league_players` - ADD PRIMARY KEY (`id`), - ADD KEY `league_players_user_id_foreign` (`user_id`), - ADD KEY `league_players_ladder_id_foreign` (`ladder_id`); - --- --- Indexes for table `maps` --- -ALTER TABLE `maps` - ADD PRIMARY KEY (`id`) USING BTREE; - --- --- Indexes for table `map_headers` --- -ALTER TABLE `map_headers` - ADD PRIMARY KEY (`id`), - ADD KEY `map_headers_map_id_foreign` (`map_id`); - --- --- Indexes for table `map_pools` --- -ALTER TABLE `map_pools` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `map_side_strings` --- -ALTER TABLE `map_side_strings` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `map_waypoints` --- -ALTER TABLE `map_waypoints` - ADD PRIMARY KEY (`id`), - ADD KEY `map_waypoints_map_header_id_foreign` (`map_header_id`); - --- --- Indexes for table `object_schema_managers` --- -ALTER TABLE `object_schema_managers` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `password_resets` --- -ALTER TABLE `password_resets` - ADD KEY `password_resets_email_index` (`email`) USING BTREE, - ADD KEY `password_resets_token_index` (`token`) USING BTREE; - --- --- Indexes for table `players` --- -ALTER TABLE `players` - ADD PRIMARY KEY (`id`) USING BTREE; - --- --- Indexes for table `player_active_handles` --- -ALTER TABLE `player_active_handles` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `player_alerts` --- -ALTER TABLE `player_alerts` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `player_caches` --- -ALTER TABLE `player_caches` - ADD PRIMARY KEY (`id`), - ADD KEY `player_caches_ladder_history_id_player_id_index` (`ladder_history_id`,`player_id`), - ADD KEY `player_caches_ladder_history_id_points_index` (`ladder_history_id`,`points`); - --- --- Indexes for table `player_cache_updates` --- -ALTER TABLE `player_cache_updates` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `player_data_strings` --- -ALTER TABLE `player_data_strings` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `player_games` --- -ALTER TABLE `player_games` - ADD PRIMARY KEY (`id`) USING BTREE; - --- --- Indexes for table `player_game_reports` --- -ALTER TABLE `player_game_reports` - ADD PRIMARY KEY (`id`), - ADD KEY `player_game_reports_player_id_index` (`player_id`), - ADD KEY `player_game_reports_game_report_id_index` (`game_report_id`); - --- --- Indexes for table `player_histories` --- -ALTER TABLE `player_histories` - ADD PRIMARY KEY (`id`), - ADD KEY `player_histories_player_id_index` (`player_id`); - --- --- Indexes for table `player_points` --- -ALTER TABLE `player_points` - ADD PRIMARY KEY (`id`) USING BTREE; - --- --- Indexes for table `player_ratings` --- -ALTER TABLE `player_ratings` - ADD PRIMARY KEY (`id`), - ADD KEY `player_ratings_player_id_index` (`player_id`), - ADD KEY `player_ratings_rating_index` (`rating`); - --- --- Indexes for table `qm_canceled_matches` --- -ALTER TABLE `qm_canceled_matches` - ADD PRIMARY KEY (`id`), - ADD KEY `qm_canceled_matches_qm_match_id_foreign` (`qm_match_id`), - ADD KEY `qm_canceled_matches_player_id_foreign` (`player_id`), - ADD KEY `qm_canceled_matches_ladder_id_foreign` (`ladder_id`); - --- --- Indexes for table `qm_connection_stats` --- -ALTER TABLE `qm_connection_stats` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `qm_ladder_rules` --- -ALTER TABLE `qm_ladder_rules` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `qm_maps` --- -ALTER TABLE `qm_maps` - ADD PRIMARY KEY (`id`), - ADD KEY `qm_maps_map_id_index` (`map_id`); - --- --- Indexes for table `qm_maps_backup` --- -ALTER TABLE `qm_maps_backup` - ADD PRIMARY KEY (`id`), - ADD KEY `qm_maps_map_id_index` (`map_id`); - --- --- Indexes for table `qm_maps_old` --- -ALTER TABLE `qm_maps_old` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `qm_matches` --- -ALTER TABLE `qm_matches` - ADD PRIMARY KEY (`id`), - ADD KEY `qm_matches_qm_map_id_index` (`qm_map_id`); - --- --- Indexes for table `qm_match_players` --- -ALTER TABLE `qm_match_players` - ADD PRIMARY KEY (`id`), - ADD KEY `qm_match_players_qm_match_id_index` (`qm_match_id`); - --- --- Indexes for table `qm_match_states` --- -ALTER TABLE `qm_match_states` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `qm_queue_entries` --- -ALTER TABLE `qm_queue_entries` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `sides` --- -ALTER TABLE `sides` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `spawn_options` --- -ALTER TABLE `spawn_options` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `spawn_option_strings` --- -ALTER TABLE `spawn_option_strings` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `spawn_option_types` --- -ALTER TABLE `spawn_option_types` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `spawn_option_values` --- -ALTER TABLE `spawn_option_values` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `state_types` --- -ALTER TABLE `state_types` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `stats2` --- -ALTER TABLE `stats2` - ADD KEY `stats2_id_index` (`id`), - ADD KEY `stats2_player_game_report_id_index` (`player_game_report_id`); - --- --- Indexes for table `tunnels` --- -ALTER TABLE `tunnels` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `users` --- -ALTER TABLE `users` - ADD PRIMARY KEY (`id`) USING BTREE, - ADD UNIQUE KEY `users_email_unique` (`email`) USING BTREE; - --- --- Indexes for table `user_ratings` --- -ALTER TABLE `user_ratings` - ADD PRIMARY KEY (`id`), - ADD KEY `user_ratings_user_id_index` (`user_id`), - ADD KEY `user_ratings_rating_index` (`rating`); - --- --- Indexes for table `user_settings` --- -ALTER TABLE `user_settings` - ADD PRIMARY KEY (`id`), - ADD KEY `user_settings_user_id_foreign` (`user_id`); - --- --- AUTO_INCREMENT for dumped tables --- - --- --- AUTO_INCREMENT for table `achievements` --- -ALTER TABLE `achievements` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `achievements_progress` --- -ALTER TABLE `achievements_progress` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `bans` --- -ALTER TABLE `bans` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `cards` --- -ALTER TABLE `cards` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `clans` --- -ALTER TABLE `clans` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `clan_invitations` --- -ALTER TABLE `clan_invitations` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `clan_players` --- -ALTER TABLE `clan_players` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `clan_roles` --- -ALTER TABLE `clan_roles` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `countable_game_objects` --- -ALTER TABLE `countable_game_objects` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `countable_object_heaps` --- -ALTER TABLE `countable_object_heaps` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `email_verifications` --- -ALTER TABLE `email_verifications` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `games` --- -ALTER TABLE `games` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `games_backup` --- -ALTER TABLE `games_backup` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `games_raw` --- -ALTER TABLE `games_raw` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `game_audit` --- -ALTER TABLE `game_audit` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `game_object_schemas` --- -ALTER TABLE `game_object_schemas` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `game_reports` --- -ALTER TABLE `game_reports` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `game_stats` --- -ALTER TABLE `game_stats` - MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `ip_addresses` --- -ALTER TABLE `ip_addresses` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `ip_address_histories` --- -ALTER TABLE `ip_address_histories` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `irc_associations` --- -ALTER TABLE `irc_associations` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `irc_hostmasks` --- -ALTER TABLE `irc_hostmasks` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `irc_players` --- -ALTER TABLE `irc_players` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `jobs` --- -ALTER TABLE `jobs` - MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `ladders` --- -ALTER TABLE `ladders` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `ladder_admins` --- -ALTER TABLE `ladder_admins` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `ladder_alerts` --- -ALTER TABLE `ladder_alerts` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `ladder_alert_players` --- -ALTER TABLE `ladder_alert_players` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `ladder_games` --- -ALTER TABLE `ladder_games` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `ladder_history` --- -ALTER TABLE `ladder_history` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `ladder_types` --- -ALTER TABLE `ladder_types` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `league_players` --- -ALTER TABLE `league_players` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `maps` --- -ALTER TABLE `maps` - MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `map_headers` --- -ALTER TABLE `map_headers` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `map_pools` --- -ALTER TABLE `map_pools` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `map_side_strings` --- -ALTER TABLE `map_side_strings` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `map_waypoints` --- -ALTER TABLE `map_waypoints` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `object_schema_managers` --- -ALTER TABLE `object_schema_managers` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `players` --- -ALTER TABLE `players` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `player_active_handles` --- -ALTER TABLE `player_active_handles` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `player_alerts` --- -ALTER TABLE `player_alerts` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `player_caches` --- -ALTER TABLE `player_caches` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `player_cache_updates` --- -ALTER TABLE `player_cache_updates` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `player_data_strings` --- -ALTER TABLE `player_data_strings` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `player_games` --- -ALTER TABLE `player_games` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `player_game_reports` --- -ALTER TABLE `player_game_reports` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `player_histories` --- -ALTER TABLE `player_histories` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `player_points` --- -ALTER TABLE `player_points` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `player_ratings` --- -ALTER TABLE `player_ratings` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `qm_canceled_matches` --- -ALTER TABLE `qm_canceled_matches` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `qm_connection_stats` --- -ALTER TABLE `qm_connection_stats` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `qm_ladder_rules` --- -ALTER TABLE `qm_ladder_rules` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `qm_maps` --- -ALTER TABLE `qm_maps` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `qm_maps_backup` --- -ALTER TABLE `qm_maps_backup` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `qm_maps_old` --- -ALTER TABLE `qm_maps_old` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `qm_matches` --- -ALTER TABLE `qm_matches` - MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `qm_match_players` --- -ALTER TABLE `qm_match_players` - MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `qm_match_states` --- -ALTER TABLE `qm_match_states` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `qm_queue_entries` --- -ALTER TABLE `qm_queue_entries` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `sides` --- -ALTER TABLE `sides` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `spawn_options` --- -ALTER TABLE `spawn_options` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `spawn_option_strings` --- -ALTER TABLE `spawn_option_strings` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `spawn_option_types` --- -ALTER TABLE `spawn_option_types` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `spawn_option_values` --- -ALTER TABLE `spawn_option_values` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `state_types` --- -ALTER TABLE `state_types` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `stats2` --- -ALTER TABLE `stats2` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `tunnels` --- -ALTER TABLE `tunnels` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `users` --- -ALTER TABLE `users` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `user_ratings` --- -ALTER TABLE `user_ratings` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `user_settings` --- -ALTER TABLE `user_settings` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- Constraints for dumped tables --- - --- --- Constraints for table `achievements` --- -ALTER TABLE `achievements` - ADD CONSTRAINT `achievements_ladder_id_foreign` FOREIGN KEY (`ladder_id`) REFERENCES `ladders` (`id`) ON DELETE CASCADE; - --- --- Constraints for table `achievements_progress` --- -ALTER TABLE `achievements_progress` - ADD CONSTRAINT `achievements_progress_achievement_id_foreign` FOREIGN KEY (`achievement_id`) REFERENCES `achievements` (`id`) ON DELETE CASCADE, - ADD CONSTRAINT `achievements_progress_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE; - --- --- Constraints for table `game_audit` --- -ALTER TABLE `game_audit` - ADD CONSTRAINT `game_audit_game_id_foreign` FOREIGN KEY (`game_id`) REFERENCES `games` (`id`) ON DELETE CASCADE, - ADD CONSTRAINT `game_audit_ladder_history_id_foreign` FOREIGN KEY (`ladder_history_id`) REFERENCES `ladder_history` (`id`) ON DELETE CASCADE; - --- --- Constraints for table `league_players` --- -ALTER TABLE `league_players` - ADD CONSTRAINT `league_players_ladder_id_foreign` FOREIGN KEY (`ladder_id`) REFERENCES `ladders` (`id`), - ADD CONSTRAINT `league_players_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`); - --- --- Constraints for table `map_headers` --- -ALTER TABLE `map_headers` - ADD CONSTRAINT `map_headers_map_id_foreign` FOREIGN KEY (`map_id`) REFERENCES `maps` (`id`) ON DELETE CASCADE; - --- --- Constraints for table `map_waypoints` --- -ALTER TABLE `map_waypoints` - ADD CONSTRAINT `map_waypoints_map_header_id_foreign` FOREIGN KEY (`map_header_id`) REFERENCES `map_headers` (`id`) ON DELETE CASCADE; - --- --- Constraints for table `qm_canceled_matches` --- -ALTER TABLE `qm_canceled_matches` - ADD CONSTRAINT `qm_canceled_matches_ladder_id_foreign` FOREIGN KEY (`ladder_id`) REFERENCES `ladders` (`id`) ON DELETE CASCADE, - ADD CONSTRAINT `qm_canceled_matches_player_id_foreign` FOREIGN KEY (`player_id`) REFERENCES `players` (`id`) ON DELETE CASCADE, - ADD CONSTRAINT `qm_canceled_matches_qm_match_id_foreign` FOREIGN KEY (`qm_match_id`) REFERENCES `qm_matches` (`id`) ON DELETE CASCADE; - --- --- Constraints for table `user_settings` --- -ALTER TABLE `user_settings` - ADD CONSTRAINT `user_settings_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE; -COMMIT; - -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +CREATE DATABASE IF NOT EXISTS cncnet_api; +CREATE DATABASE IF NOT EXISTS cncnet_irc; \ No newline at end of file