From c41377ca3a69a0f0dd21e866351730075158701a Mon Sep 17 00:00:00 2001 From: andyksaw Date: Sat, 2 Nov 2024 13:33:57 +0900 Subject: [PATCH 1/3] Squash migrations and remove player alias model --- .../Commands/GenerateScoutIndexesCommand.php | 2 - .../MinecraftPlayerAliasSearchController.php | 4 +- .../BuilderRankApplicationController.php | 4 +- .../Panel/MinecraftPlayerLookupController.php | 7 +- app/Models/MinecraftPlayer.php | 9 - app/Models/MinecraftPlayerAlias.php | 47 -- .../factories/MinecraftPlayerAliasFactory.php | 28 - .../2017_09_15_131358_create_users.php | 70 -- .../2017_09_15_154714_create_servers.php | 104 --- .../2017_09_17_142032_create_bans.php | 65 -- .../2017_10_03_124225_create_donations.php | 41 -- .../2017_10_14_134236_create_jobs_table.php | 36 - ..._21_102044_create_user_register_emails.php | 33 - ...2018_03_22_153113_create_account_oauth.php | 34 - ...27_142354_create_password_resets_table.php | 32 - .../2018_04_20_141003_alter_donations.php | 36 - .../2018_06_30_090859_create_email_change.php | 40 - ...9_032541_alter_account_links_add_email.php | 32 - .../2018_08_17_173709_create_payments.php | 41 -- ...18_08_22_153055_create_player_warnings.php | 41 -- ...2018_08_23_141229_delete_server_tokens.php | 56 -- ...2018_09_02_034512_allow_null_ban_staff.php | 48 -- .../2018_09_09_032458_create_groups.php | 45 -- ..._26_081858_create_minecraft_auth_codes.php | 37 - ..._07_27_183009_add_username_to_accounts.php | 32 - ...4_add_username_to_unactivated_accounts.php | 32 - ...9_08_27_121924_combine_accounts_tables.php | 30 - ...9_04_153202_add_discourse_group_column.php | 32 - ...019_10_06_045949_create_donation_perks.php | 42 -- ...19_10_14_122946_create_stripe_sessions.php | 36 - ...01_create_personal_access_tokens_table.php | 36 - ...3534_add_panel_access_column_to_groups.php | 32 - ...0328_delete_players_minecraft_playtime.php | 32 - ..._rename_players_minecraft_last_seen_at.php | 32 - ...lable_players_minecraft_last_synced_at.php | 32 - ...2_24_163432_add_2fa_fields_to_accounts.php | 38 - ...07_28_132343_add_minecraft_group_names.php | 34 - ...021_07_31_134903_create_donation_tiers.php | 40 - ...1_07_31_134904_migrate_lifetime_donors.php | 105 --- ...1_08_02_180000_create_customer_columns.php | 42 -- ...8_02_180001_create_subscriptions_table.php | 43 -- ...180002_create_subscription_items_table.php | 40 - ...1_08_04_163409_create_account_payments.php | 41 -- ..._20_130638_create_minecraft_loot_boxes.php | 48 -- .../2022_04_11_103651_remove_loot_boxes.php | 48 -- .../2022_04_12_145615_add_account_balance.php | 32 - ..._04_12_152853_add_balance_transactions.php | 38 - ...022_04_19_120626_add_last_balance_date.php | 38 - ...2022_04_20_060549_create_product_table.php | 34 - .../2022_05_09_132856_create_pages.php | 36 - ...13_170120_remove_server_status_players.php | 36 - ..._05_15_134438_create_rank_applications.php | 40 - ...022_05_16_154731_add_builder_group_col.php | 32 - ..._05_22_154628_create_ban_appeals_table.php | 41 -- ...2022_05_28_164701_create_server_tokens.php | 50 -- ...3732_delete_account_links_and_ban_logs.php | 30 - .../2022_06_03_132514_create_group_scopes.php | 48 -- ...06_05_153600_create_activity_log_table.php | 27 - ...add_event_column_to_activity_log_table.php | 22 - ...atch_uuid_column_to_activity_log_table.php | 22 - ..._06_14_143430_add_player_last_seen_col.php | 38 - ..._06_19_140057_remove_game_account_type.php | 28 - .../2022_08_08_125414_add_badges.php | 39 - ...name_decider_account_to_decider_player.php | 36 - .../2022_08_15_151557_add_warp_showcase.php | 44 -- ..._08_29_053247_cascade_account_deletion.php | 42 -- ..._09_06_031358_create_failed_jobs_table.php | 36 - ..._09_044922_add_unban_cols_to_ban_table.php | 42 -- ...09_09_045726_move_unbans_to_bans_table.php | 71 -- .../2022_09_10_044245_drop_server_keys.php | 38 - ...022_09_12_034018_change_warnings_table.php | 60 -- .../2022_09_15_070606_create_ip_ban_table.php | 42 -- ...22_09_19_052638_rename_staff_player_id.php | 34 - .../2024_08_18_155246_delete_pages.php | 24 - ..._08_19_113119_delete_server_categories.php | 29 - ...09_03_133144_account_activation_tokens.php | 36 - ...09_04_151106_add_password_reset_expiry.php | 37 - .../2024_09_07_101052_update_email_change.php | 31 - ...2024_09_15_120334_add_badge_visibility.php | 27 - ...2_100137_create_minecraft_registration.php | 37 - .../2024_10_07_100758_remove_alias_table.php | 39 - ...07_144916_remove_default_group_members.php | 31 - ...024_10_18_100146_add_server_query_port.php | 35 - ...4_10_25_083122_create_minecraft_config.php | 30 - .../2024_10_28_110159_create_warps.php | 40 - ..._10_30_110257_add_minecraft_group_cols.php | 56 -- database/schema/mariadb-schema.sql | 696 ++++++++++++++++++ database/seeders/AccountSeeder.php | 2 +- database/seeders/BadgeSeeder.php | 8 +- database/seeders/BanAppealSeeder.php | 13 - database/seeders/DatabaseSeeder.php | 17 +- database/seeders/GameBanSeeder.php | 2 +- database/seeders/MinecraftPlayerSeeder.php | 20 +- database/seeders/PlayerWarningSeeder.php | 2 - database/seeders/ServerSeeder.php | 20 - database/seeders/ShowcaseWarpSeeder.php | 16 - .../Front/AccountMinecraftAccountTest.php | 9 +- 97 files changed, 729 insertions(+), 3343 deletions(-) delete mode 100644 app/Models/MinecraftPlayerAlias.php delete mode 100644 database/factories/MinecraftPlayerAliasFactory.php delete mode 100644 database/migrations/2017_09_15_131358_create_users.php delete mode 100644 database/migrations/2017_09_15_154714_create_servers.php delete mode 100644 database/migrations/2017_09_17_142032_create_bans.php delete mode 100644 database/migrations/2017_10_03_124225_create_donations.php delete mode 100644 database/migrations/2017_10_14_134236_create_jobs_table.php delete mode 100644 database/migrations/2018_03_21_102044_create_user_register_emails.php delete mode 100644 database/migrations/2018_03_22_153113_create_account_oauth.php delete mode 100644 database/migrations/2018_03_27_142354_create_password_resets_table.php delete mode 100644 database/migrations/2018_04_20_141003_alter_donations.php delete mode 100644 database/migrations/2018_06_30_090859_create_email_change.php delete mode 100644 database/migrations/2018_07_09_032541_alter_account_links_add_email.php delete mode 100644 database/migrations/2018_08_17_173709_create_payments.php delete mode 100644 database/migrations/2018_08_22_153055_create_player_warnings.php delete mode 100644 database/migrations/2018_08_23_141229_delete_server_tokens.php delete mode 100644 database/migrations/2018_09_02_034512_allow_null_ban_staff.php delete mode 100644 database/migrations/2018_09_09_032458_create_groups.php delete mode 100644 database/migrations/2019_05_26_081858_create_minecraft_auth_codes.php delete mode 100644 database/migrations/2019_07_27_183009_add_username_to_accounts.php delete mode 100644 database/migrations/2019_07_28_125054_add_username_to_unactivated_accounts.php delete mode 100644 database/migrations/2019_08_27_121924_combine_accounts_tables.php delete mode 100644 database/migrations/2019_09_04_153202_add_discourse_group_column.php delete mode 100644 database/migrations/2019_10_06_045949_create_donation_perks.php delete mode 100644 database/migrations/2019_10_14_122946_create_stripe_sessions.php delete mode 100644 database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php delete mode 100644 database/migrations/2020_03_22_113534_add_panel_access_column_to_groups.php delete mode 100644 database/migrations/2020_12_23_210328_delete_players_minecraft_playtime.php delete mode 100644 database/migrations/2020_12_23_210456_rename_players_minecraft_last_seen_at.php delete mode 100644 database/migrations/2020_12_23_210633_make_nullable_players_minecraft_last_synced_at.php delete mode 100644 database/migrations/2020_12_24_163432_add_2fa_fields_to_accounts.php delete mode 100644 database/migrations/2021_07_28_132343_add_minecraft_group_names.php delete mode 100644 database/migrations/2021_07_31_134903_create_donation_tiers.php delete mode 100644 database/migrations/2021_07_31_134904_migrate_lifetime_donors.php delete mode 100644 database/migrations/2021_08_02_180000_create_customer_columns.php delete mode 100644 database/migrations/2021_08_02_180001_create_subscriptions_table.php delete mode 100644 database/migrations/2021_08_02_180002_create_subscription_items_table.php delete mode 100644 database/migrations/2021_08_04_163409_create_account_payments.php delete mode 100644 database/migrations/2021_08_20_130638_create_minecraft_loot_boxes.php delete mode 100644 database/migrations/2022_04_11_103651_remove_loot_boxes.php delete mode 100644 database/migrations/2022_04_12_145615_add_account_balance.php delete mode 100644 database/migrations/2022_04_12_152853_add_balance_transactions.php delete mode 100644 database/migrations/2022_04_19_120626_add_last_balance_date.php delete mode 100644 database/migrations/2022_04_20_060549_create_product_table.php delete mode 100644 database/migrations/2022_05_09_132856_create_pages.php delete mode 100644 database/migrations/2022_05_13_170120_remove_server_status_players.php delete mode 100644 database/migrations/2022_05_15_134438_create_rank_applications.php delete mode 100644 database/migrations/2022_05_16_154731_add_builder_group_col.php delete mode 100644 database/migrations/2022_05_22_154628_create_ban_appeals_table.php delete mode 100644 database/migrations/2022_05_28_164701_create_server_tokens.php delete mode 100644 database/migrations/2022_06_02_163732_delete_account_links_and_ban_logs.php delete mode 100644 database/migrations/2022_06_03_132514_create_group_scopes.php delete mode 100644 database/migrations/2022_06_05_153600_create_activity_log_table.php delete mode 100644 database/migrations/2022_06_05_153601_add_event_column_to_activity_log_table.php delete mode 100644 database/migrations/2022_06_05_153602_add_batch_uuid_column_to_activity_log_table.php delete mode 100644 database/migrations/2022_06_14_143430_add_player_last_seen_col.php delete mode 100644 database/migrations/2022_06_19_140057_remove_game_account_type.php delete mode 100644 database/migrations/2022_08_08_125414_add_badges.php delete mode 100644 database/migrations/2022_08_13_090330_rename_decider_account_to_decider_player.php delete mode 100644 database/migrations/2022_08_15_151557_add_warp_showcase.php delete mode 100644 database/migrations/2022_08_29_053247_cascade_account_deletion.php delete mode 100644 database/migrations/2022_09_06_031358_create_failed_jobs_table.php delete mode 100644 database/migrations/2022_09_09_044922_add_unban_cols_to_ban_table.php delete mode 100644 database/migrations/2022_09_09_045726_move_unbans_to_bans_table.php delete mode 100644 database/migrations/2022_09_10_044245_drop_server_keys.php delete mode 100644 database/migrations/2022_09_12_034018_change_warnings_table.php delete mode 100644 database/migrations/2022_09_15_070606_create_ip_ban_table.php delete mode 100644 database/migrations/2022_09_19_052638_rename_staff_player_id.php delete mode 100644 database/migrations/2024_08_18_155246_delete_pages.php delete mode 100644 database/migrations/2024_08_19_113119_delete_server_categories.php delete mode 100644 database/migrations/2024_09_03_133144_account_activation_tokens.php delete mode 100644 database/migrations/2024_09_04_151106_add_password_reset_expiry.php delete mode 100644 database/migrations/2024_09_07_101052_update_email_change.php delete mode 100644 database/migrations/2024_09_15_120334_add_badge_visibility.php delete mode 100644 database/migrations/2024_10_02_100137_create_minecraft_registration.php delete mode 100644 database/migrations/2024_10_07_100758_remove_alias_table.php delete mode 100644 database/migrations/2024_10_07_144916_remove_default_group_members.php delete mode 100644 database/migrations/2024_10_18_100146_add_server_query_port.php delete mode 100644 database/migrations/2024_10_25_083122_create_minecraft_config.php delete mode 100644 database/migrations/2024_10_28_110159_create_warps.php delete mode 100644 database/migrations/2024_10_30_110257_add_minecraft_group_cols.php create mode 100644 database/schema/mariadb-schema.sql delete mode 100644 database/seeders/BanAppealSeeder.php delete mode 100644 database/seeders/ServerSeeder.php delete mode 100644 database/seeders/ShowcaseWarpSeeder.php diff --git a/app/Console/Commands/GenerateScoutIndexesCommand.php b/app/Console/Commands/GenerateScoutIndexesCommand.php index 7c9c127a2..6b30b0121 100644 --- a/app/Console/Commands/GenerateScoutIndexesCommand.php +++ b/app/Console/Commands/GenerateScoutIndexesCommand.php @@ -4,7 +4,6 @@ use App\Models\Account; use App\Models\GamePlayerBan; -use App\Models\MinecraftPlayerAlias; use Illuminate\Console\Command; class GenerateScoutIndexesCommand extends Command @@ -14,7 +13,6 @@ class GenerateScoutIndexesCommand extends Command private $models = [ Account::class, GamePlayerBan::class, - MinecraftPlayerAlias::class, ]; public function handle() diff --git a/app/Http/Controllers/Api/v1/MinecraftPlayerAliasSearchController.php b/app/Http/Controllers/Api/v1/MinecraftPlayerAliasSearchController.php index 57d100410..67aae393c 100644 --- a/app/Http/Controllers/Api/v1/MinecraftPlayerAliasSearchController.php +++ b/app/Http/Controllers/Api/v1/MinecraftPlayerAliasSearchController.php @@ -2,7 +2,7 @@ namespace App\Http\Controllers\Api\v1; -use App\Models\MinecraftPlayerAlias; +use App\Models\MinecraftPlayer; use Illuminate\Http\Request; class MinecraftPlayerAliasSearchController @@ -11,7 +11,7 @@ public function __invoke(Request $request) { $query = $request->input('query'); - return MinecraftPlayerAlias::search($query) + return MinecraftPlayer::where('alias', 'like', '%'.$query.'%') ->take(25) ->get(); } diff --git a/app/Http/Controllers/Front/BuilderRankApplicationController.php b/app/Http/Controllers/Front/BuilderRankApplicationController.php index 414c88fbe..554d12356 100644 --- a/app/Http/Controllers/Front/BuilderRankApplicationController.php +++ b/app/Http/Controllers/Front/BuilderRankApplicationController.php @@ -17,8 +17,8 @@ public function index( Request $request, ) { $minecraftUsername = $request->user() - ?->minecraftAccount?->first() - ?->aliases?->first() + ?->minecraftAccount + ?->first() ?->alias; $applicationInProgress = BuilderRankApplication::where('status', ApplicationStatus::IN_PROGRESS->value) diff --git a/app/Http/Controllers/Panel/MinecraftPlayerLookupController.php b/app/Http/Controllers/Panel/MinecraftPlayerLookupController.php index 8024ddae0..56a2249b9 100644 --- a/app/Http/Controllers/Panel/MinecraftPlayerLookupController.php +++ b/app/Http/Controllers/Panel/MinecraftPlayerLookupController.php @@ -6,7 +6,6 @@ use App\Core\Domains\Mojang\Api\MojangPlayerApi; use App\Http\Controllers\WebController; use App\Models\MinecraftPlayer; -use App\Models\MinecraftPlayerAlias; use Illuminate\Http\Request; use Illuminate\Support\Facades\App; @@ -39,13 +38,13 @@ private function lookupByStoredAlias($alias): ?MinecraftPlayer return null; } - $mcPlayerAlias = MinecraftPlayerAlias::where('alias', $alias)->first(); + $player = MinecraftPlayer::where('alias', $alias)->first(); - if ($mcPlayerAlias == null) { + if ($player == null) { return null; } - return $mcPlayerAlias->minecraftPlayer; + return $player; } /** diff --git a/app/Models/MinecraftPlayer.php b/app/Models/MinecraftPlayer.php index 99ab1d9bd..e0867c33a 100644 --- a/app/Models/MinecraftPlayer.php +++ b/app/Models/MinecraftPlayer.php @@ -46,15 +46,6 @@ public function account(): BelongsTo ); } - public function aliases(): HasMany - { - return $this->hasMany( - related: MinecraftPlayerAlias::class, - foreignKey: 'player_minecraft_id', - localKey: 'player_minecraft_id', - ); - } - public function gamePlayerBans(): HasMany { return $this->hasMany( diff --git a/app/Models/MinecraftPlayerAlias.php b/app/Models/MinecraftPlayerAlias.php deleted file mode 100644 index 7c1c72e9c..000000000 --- a/app/Models/MinecraftPlayerAlias.php +++ /dev/null @@ -1,47 +0,0 @@ - 'datetime', - ]; - - public function minecraftPlayer(): BelongsTo - { - return $this->belongsTo(MinecraftPlayer::class, 'player_minecraft_id', 'player_minecraft_id'); - } - - public function toSearchableArray() - { - return [ - 'players_minecraft_alias_id' => $this->getKey(), - 'alias' => $this->alias, - 'player_id' => $this->minecraftPlayer->getKey(), - ]; - } -} diff --git a/database/factories/MinecraftPlayerAliasFactory.php b/database/factories/MinecraftPlayerAliasFactory.php deleted file mode 100644 index aeaf7b9a6..000000000 --- a/database/factories/MinecraftPlayerAliasFactory.php +++ /dev/null @@ -1,28 +0,0 @@ - substr($this->faker->userName, 0, 16), - 'registered_at' => $this->faker->dateTimeBetween('-180days', '-1days'), - ]; - } -} diff --git a/database/migrations/2017_09_15_131358_create_users.php b/database/migrations/2017_09_15_131358_create_users.php deleted file mode 100644 index 0c453cff4..000000000 --- a/database/migrations/2017_09_15_131358_create_users.php +++ /dev/null @@ -1,70 +0,0 @@ -increments('account_id'); - $table->string('email'); - $table->string('password'); - $table->string('remember_token', 60)->nullable(); - $table->string('last_login_ip', 45)->nullable(); - $table->timestamp('last_login_at')->nullable(); - $table->timestamps(); - }); - - /** - * Represents a single Minecraft player identified by uuid, tied to a player_id. - */ - Schema::create('players_minecraft', function (Blueprint $table) { - $table->increments('player_minecraft_id'); - $table->string('uuid', 60)->unique(); - $table->integer('account_id')->unsigned()->nullable(); - $table->integer('playtime')->unsigned()->comment('Total playtime in minutes'); - $table->datetime('last_seen_at'); - $table->timestamps(); - - $table->index('uuid'); - $table->foreign('account_id')->references('account_id')->on('accounts'); - }); - - /** - * Represents an in-game Minecraft name. Used to track name changes in Minecraft. - */ - Schema::create('players_minecraft_aliases', function (Blueprint $table) { - $table->increments('players_minecraft_alias_id'); - $table->integer('player_minecraft_id')->unsigned(); - $table->string('alias'); - $table->timestamp('registered_at')->nullable()->comment('The actual datetime they changed their alias to this'); - $table->timestamps(); - - $table->index('alias'); - $table->foreign('player_minecraft_id')->references('player_minecraft_id')->on('players_minecraft'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('players_minecraft_aliases'); - Schema::dropIfExists('players_minecraft'); - Schema::dropIfExists('accounts'); - } -} diff --git a/database/migrations/2017_09_15_154714_create_servers.php b/database/migrations/2017_09_15_154714_create_servers.php deleted file mode 100644 index fb4818d97..000000000 --- a/database/migrations/2017_09_15_154714_create_servers.php +++ /dev/null @@ -1,104 +0,0 @@ -increments('server_category_id'); - $table->string('name'); - $table->integer('display_order'); - $table->timestamps(); - }); - - Schema::create('servers', function (Blueprint $table) { - $table->increments('server_id'); - $table->integer('server_category_id')->unsigned(); - $table->string('name'); - $table->string('ip'); - $table->string('ip_alias')->nullable()->comment('An alternative address to connect to the server'); - $table->string('port')->nullable(); - $table->integer('game_type')->unsigned()->comment('Type of game server, used to determine an adapter to use for status querying'); - $table->boolean('is_port_visible')->default(true)->comment('Whether the port will be displayed'); - $table->boolean('is_querying')->default(true)->commenet('Whether the server will be pinged for status updates'); - $table->boolean('is_visible')->default(true)->comment('Whether the server is visible in the server feed'); - $table->integer('display_order'); - $table->timestamps(); - - $table->foreign('server_category_id')->references('server_category_id')->on('server_categories'); - }); - - /** - * Represents a set of rights to API resources. - */ - Schema::create('server_keys', function (Blueprint $table) { - $table->increments('server_key_id'); - $table->integer('server_id')->unsigned()->comment('The only server this key has access to'); - $table->boolean('can_local_ban')->default(true)->comment('Whether this key can create bans that affect only the server the player was banned on'); - $table->boolean('can_global_ban')->default(false)->comment('Whether this key can create bans that affect every PCB service'); - $table->boolean('can_access_ranks')->default(true)->comment('Whether this key can access rank data of players'); - $table->timestamps(); - - $table->foreign('server_id')->references('server_id')->on('servers'); - }); - - /** - * Represents a refresh token. - * Storage of JWT so we can revoke resource access at any time. - */ - Schema::create('server_key_tokens', function (Blueprint $table) { - $table->increments('server_key_token_id'); - $table->integer('server_key_id')->unsigned(); - $table->char('token_hash', 60)->comment('Token hash for comparison purposes'); - $table->boolean('is_blacklisted')->comment('Whether this token has had access revoked'); - $table->timestamps(); - - $table->foreign('server_key_id')->references('server_key_id')->on('server_keys'); - }); - - Schema::create('server_statuses', function (Blueprint $table) { - $table->bigIncrements('server_status_id'); - $table->integer('server_id')->unsigned(); - $table->boolean('is_online'); - $table->integer('num_of_players')->comment('Number of players currently connected'); - $table->integer('num_of_slots')->comment('Maximum number of players the server can hold'); - $table->timestamps(); - - $table->foreign('server_id')->references('server_id')->on('servers'); - }); - - Schema::create('server_statuses_players', function (Blueprint $table) { - $table->bigIncrements('server_status_player_id'); - $table->integer('server_status_id')->unsigned(); - $table->string('player_type'); - $table->integer('player_id')->unsigned(); - - // why is this spewing errors? (╯°□°)╯︵ ┻━┻ - // $table->foreign('server_status_id')->references('server_status_id')->on('server_statuses'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('server_statuses_players'); - Schema::dropIfExists('server_statuses'); - Schema::dropIfExists('server_key_tokens'); - Schema::dropIfExists('server_keys'); - Schema::dropIfExists('servers'); - Schema::dropIfExists('server_categories'); - } -} diff --git a/database/migrations/2017_09_17_142032_create_bans.php b/database/migrations/2017_09_17_142032_create_bans.php deleted file mode 100644 index b6235b293..000000000 --- a/database/migrations/2017_09_17_142032_create_bans.php +++ /dev/null @@ -1,65 +0,0 @@ -increments('game_ban_id'); - $table->integer('server_id')->unsigned()->nullable(); - $table->integer('banned_player_id')->unsigned(); - $table->string('banned_player_type')->comment('Banned player identifier type'); - $table->string('banned_alias_at_time')->comment('Alias of the player at ban time for logging purposes'); - $table->integer('staff_player_id')->unsigned(); - $table->string('staff_player_type')->comment('Staff player identifier type'); - $table->text('reason')->nullable(); - $table->boolean('is_active')->comment('Whether the ban is active'); - $table->boolean('is_global_ban')->default(true)->comment('Whether this player is banned on all PCB servers, not just the server they were banned on'); - $table->timestamp('expires_at')->nullable()->comment('Date that this ban auto-expires on'); - $table->timestamps(); - }); - - Schema::create('game_network_unbans', function (Blueprint $table) { - $table->increments('game_unban_id'); - $table->integer('game_ban_id')->unsigned(); - $table->integer('staff_player_id')->unsigned(); - $table->string('staff_player_type'); - $table->timestamps(); - - $table->foreign('game_ban_id')->references('game_ban_id')->on('game_network_bans'); - }); - - Schema::create('game_network_ban_logs', function (Blueprint $table) { - $table->increments('game_ban_log_id'); - $table->integer('game_ban_id')->unsigned()->comment('Ban record acted upon/created'); - $table->integer('server_key_id')->unsigned()->comment('Server key used in the action'); - $table->integer('ban_action')->comment('BanActionEnum value'); - $table->ipAddress('incoming_ip')->nullable()->comment('IP address of the action creator'); - $table->timestamp('created_at')->default(\DB::raw('CURRENT_TIMESTAMP')); - - $table->foreign('game_ban_id')->references('game_ban_id')->on('game_network_bans'); - $table->foreign('server_key_id')->references('server_key_id')->on('server_keys'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('game_network_ban_logs'); - Schema::dropIfExists('game_network_unbans'); - Schema::dropIfExists('game_network_bans'); - } -} diff --git a/database/migrations/2017_10_03_124225_create_donations.php b/database/migrations/2017_10_03_124225_create_donations.php deleted file mode 100644 index 7b8434768..000000000 --- a/database/migrations/2017_10_03_124225_create_donations.php +++ /dev/null @@ -1,41 +0,0 @@ -increments('donation_id')->unsigned(); - $table->integer('account_id')->unsigned()->nullable(); - $table->integer('forum_user_id')->unsigned()->comment('ID of their forum account. To be replaced later when we switch to discord'); - $table->float('amount')->comment('Amount donated in dollars'); - $table->datetime('perks_end_at')->nullable()->comment('Expiry date of donator perks if not a lifetime threshold donation'); - $table->integer('prev_rank_id')->unsigned()->nullable()->comment('ID of their previous group before becoming a donator'); - $table->boolean('is_lifetime_perks')->default(false)->comment('Whether the user gains donator perks for life'); - $table->boolean('is_active')->default(true)->comment('Whether the donation perks are currently active'); - $table->timestamps(); - - $table->index(['perks_end_at', 'amount']); - $table->foreign('account_id')->references('account_id')->on('accounts'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('donations'); - } -} diff --git a/database/migrations/2017_10_14_134236_create_jobs_table.php b/database/migrations/2017_10_14_134236_create_jobs_table.php deleted file mode 100644 index 1be9e8a80..000000000 --- a/database/migrations/2017_10_14_134236_create_jobs_table.php +++ /dev/null @@ -1,36 +0,0 @@ -bigIncrements('id'); - $table->string('queue')->index(); - $table->longText('payload'); - $table->unsignedTinyInteger('attempts'); - $table->unsignedInteger('reserved_at')->nullable(); - $table->unsignedInteger('available_at'); - $table->unsignedInteger('created_at'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('jobs'); - } -} diff --git a/database/migrations/2018_03_21_102044_create_user_register_emails.php b/database/migrations/2018_03_21_102044_create_user_register_emails.php deleted file mode 100644 index 0eb049c24..000000000 --- a/database/migrations/2018_03_21_102044_create_user_register_emails.php +++ /dev/null @@ -1,33 +0,0 @@ -increments('unactivated_account_id'); - $table->string('email'); - $table->string('password'); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('accounts_unactivated'); - } -} diff --git a/database/migrations/2018_03_22_153113_create_account_oauth.php b/database/migrations/2018_03_22_153113_create_account_oauth.php deleted file mode 100644 index 9f70a9906..000000000 --- a/database/migrations/2018_03_22_153113_create_account_oauth.php +++ /dev/null @@ -1,34 +0,0 @@ -increments('account_link_id'); - $table->integer('account_id'); - $table->string('provider_name')->nullable(); - $table->string('provider_id')->unique()->nullable(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('account_links'); - } -} diff --git a/database/migrations/2018_03_27_142354_create_password_resets_table.php b/database/migrations/2018_03_27_142354_create_password_resets_table.php deleted file mode 100644 index cd6e7e2bf..000000000 --- a/database/migrations/2018_03_27_142354_create_password_resets_table.php +++ /dev/null @@ -1,32 +0,0 @@ -string('email')->index(); - $table->string('token'); - $table->timestamp('created_at')->nullable(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('account_password_resets'); - } -} diff --git a/database/migrations/2018_04_20_141003_alter_donations.php b/database/migrations/2018_04_20_141003_alter_donations.php deleted file mode 100644 index 0048548b5..000000000 --- a/database/migrations/2018_04_20_141003_alter_donations.php +++ /dev/null @@ -1,36 +0,0 @@ -dropColumn('prev_rank_id'); - }); - Schema::table('donations', function (Blueprint $table) { - $table->dropColumn('forum_user_id'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('donations', function (Blueprint $table) { - $table->integer('prev_rank_id')->unsigned()->nullable()->after('perks_end_at')->comment('ID of their previous group before becoming a donator'); - $table->integer('forum_user_id')->unsigned()->default(0)->after('account_id')->comment('ID of their forum account. To be replaced later when we switch to discord'); - }); - } -} diff --git a/database/migrations/2018_06_30_090859_create_email_change.php b/database/migrations/2018_06_30_090859_create_email_change.php deleted file mode 100644 index 4052023bc..000000000 --- a/database/migrations/2018_06_30_090859_create_email_change.php +++ /dev/null @@ -1,40 +0,0 @@ -increments('account_email_change_id'); - $table->integer('account_id')->unsigned(); - $table->string('token'); - $table->string('email_previous'); - $table->string('email_new'); - $table->boolean('is_previous_confirmed'); - $table->boolean('is_new_confirmed'); - $table->timestamps(); - - $table->index(['token', 'email_previous', 'email_new']); - $table->foreign('account_id')->references('account_id')->on('accounts'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('account_email_changes'); - } -} diff --git a/database/migrations/2018_07_09_032541_alter_account_links_add_email.php b/database/migrations/2018_07_09_032541_alter_account_links_add_email.php deleted file mode 100644 index 431f66edb..000000000 --- a/database/migrations/2018_07_09_032541_alter_account_links_add_email.php +++ /dev/null @@ -1,32 +0,0 @@ -string('provider_email')->after('provider_id')->default(''); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('account_links', function (Blueprint $table) { - $table->dropColumn('provider_email'); - }); - } -} diff --git a/database/migrations/2018_08_17_173709_create_payments.php b/database/migrations/2018_08_17_173709_create_payments.php deleted file mode 100644 index f54105fb7..000000000 --- a/database/migrations/2018_08_17_173709_create_payments.php +++ /dev/null @@ -1,41 +0,0 @@ -increments('account_payment_id'); - $table->string('payment_type')->comment('What the payment was for: donation, purchase, etc'); - $table->integer('payment_id')->unsigned()->comment('Id in its corresponding table'); - $table->double('payment_amount'); - $table->string('payment_source'); - $table->integer('account_id')->unsigned()->nullable(); - $table->boolean('is_processed')->default(false); - $table->boolean('is_refunded')->default(false); - $table->boolean('is_subscription_payment')->default(false); - $table->timestamps(); - - $table->foreign('account_id')->references('account_id')->on('accounts'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('account_payments'); - } -} diff --git a/database/migrations/2018_08_22_153055_create_player_warnings.php b/database/migrations/2018_08_22_153055_create_player_warnings.php deleted file mode 100644 index 5376777fd..000000000 --- a/database/migrations/2018_08_22_153055_create_player_warnings.php +++ /dev/null @@ -1,41 +0,0 @@ -increments('game_warning_id'); - $table->integer('server_id')->unsigned()->nullable(); - $table->integer('warned_player_id')->unsigned(); - $table->string('warned_player_type')->comment('Banned player identifier type'); - $table->integer('staff_player_id')->unsigned(); - $table->string('staff_player_type')->comment('Staff player identifier type'); - $table->text('reason')->nullable(); - $table->integer('weight')->comment('How many points the infraction is worth'); - $table->boolean('is_active')->default(true); - $table->timestamps(); - - $table->foreign('server_id')->references('server_id')->on('servers'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('game_network_warnings'); - } -} diff --git a/database/migrations/2018_08_23_141229_delete_server_tokens.php b/database/migrations/2018_08_23_141229_delete_server_tokens.php deleted file mode 100644 index 07aeb3e6c..000000000 --- a/database/migrations/2018_08_23_141229_delete_server_tokens.php +++ /dev/null @@ -1,56 +0,0 @@ -string('token')->after('server_id')->default(''); - }); - Schema::table('server_keys', function (Blueprint $table) { - $table->boolean('can_warn')->after('can_global_ban')->default(false); - }); - Schema::table('server_keys', function (Blueprint $table) { - $table->dropColumn('can_access_ranks'); - }); - - Schema::dropIfExists('server_key_tokens'); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::create('server_key_tokens', function (Blueprint $table) { - $table->increments('server_key_token_id'); - $table->integer('server_key_id')->unsigned(); - $table->char('token_hash', 60)->comment('Token hash for comparison purposes'); - $table->boolean('is_blacklisted')->comment('Whether this token has had access revoked'); - $table->timestamps(); - - $table->foreign('server_key_id')->references('server_key_id')->on('server_keys'); - }); - - Schema::table('server_keys', function (Blueprint $table) { - $table->dropColumn('token'); - }); - Schema::table('server_keys', function (Blueprint $table) { - $table->dropColumn('can_warn'); - }); - Schema::table('server_keys', function (Blueprint $table) { - $table->boolean('can_access_ranks')->after('can_global_ban')->default(true)->comment('Whether this key can access rank data of players'); - }); - } -} diff --git a/database/migrations/2018_09_02_034512_allow_null_ban_staff.php b/database/migrations/2018_09_02_034512_allow_null_ban_staff.php deleted file mode 100644 index c7de979c1..000000000 --- a/database/migrations/2018_09_02_034512_allow_null_ban_staff.php +++ /dev/null @@ -1,48 +0,0 @@ -integer('staff_player_id')->unsigned()->nullable()->change(); - }); - - Schema::table('game_network_unbans', function (Blueprint $table) { - $table->integer('staff_player_id')->unsigned()->nullable()->change(); - }); - - Schema::table('game_network_warnings', function (Blueprint $table) { - $table->integer('staff_player_id')->unsigned()->nullable()->change(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('game_network_warnings', function (Blueprint $table) { - $table->integer('staff_player_id')->unsigned()->change(); - }); - - Schema::table('game_network_bans', function (Blueprint $table) { - $table->integer('staff_player_id')->unsigned()->change(); - }); - - Schema::table('game_network_bans', function (Blueprint $table) { - $table->integer('staff_player_id')->unsigned()->change(); - }); - } -} diff --git a/database/migrations/2018_09_09_032458_create_groups.php b/database/migrations/2018_09_09_032458_create_groups.php deleted file mode 100644 index 2611a27ca..000000000 --- a/database/migrations/2018_09_09_032458_create_groups.php +++ /dev/null @@ -1,45 +0,0 @@ -increments('group_id'); - $table->string('name'); - $table->string('alias')->nullable(); - $table->boolean('is_default')->default(false); - $table->boolean('is_staff')->default(false); - $table->boolean('is_admin')->default(false); - }); - - Schema::create('groups_accounts', function (Blueprint $table) { - $table->increments('groups_accounts_id'); - $table->integer('group_id')->unsigned(); - $table->integer('account_id')->unsigned(); - - $table->foreign('group_id')->references('group_id')->on('groups'); - $table->foreign('account_id')->references('account_id')->on('accounts'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('groups_accounts'); - Schema::dropIfExists('groups'); - } -} diff --git a/database/migrations/2019_05_26_081858_create_minecraft_auth_codes.php b/database/migrations/2019_05_26_081858_create_minecraft_auth_codes.php deleted file mode 100644 index 7b947b70f..000000000 --- a/database/migrations/2019_05_26_081858_create_minecraft_auth_codes.php +++ /dev/null @@ -1,37 +0,0 @@ -bigIncrements('minecraft_auth_code_id'); - $table->uuid('token'); - $table->integer('player_minecraft_id')->unsigned(); - $table->string('uuid', 60)->unique(); - $table->dateTime('expires_at'); - $table->timestamps(); - - $table->index('token'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('minecraft_auth_codes'); - } -} diff --git a/database/migrations/2019_07_27_183009_add_username_to_accounts.php b/database/migrations/2019_07_27_183009_add_username_to_accounts.php deleted file mode 100644 index 20409bae0..000000000 --- a/database/migrations/2019_07_27_183009_add_username_to_accounts.php +++ /dev/null @@ -1,32 +0,0 @@ -string('username')->nullable(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('accounts', function (Blueprint $table) { - $table->dropColumn('username'); - }); - } -} diff --git a/database/migrations/2019_07_28_125054_add_username_to_unactivated_accounts.php b/database/migrations/2019_07_28_125054_add_username_to_unactivated_accounts.php deleted file mode 100644 index b145f0398..000000000 --- a/database/migrations/2019_07_28_125054_add_username_to_unactivated_accounts.php +++ /dev/null @@ -1,32 +0,0 @@ -string('username')->nullable(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('accounts_unactivated', function (Blueprint $table) { - $table->dropColumn('username'); - }); - } -} diff --git a/database/migrations/2019_08_27_121924_combine_accounts_tables.php b/database/migrations/2019_08_27_121924_combine_accounts_tables.php deleted file mode 100644 index af2d74cd4..000000000 --- a/database/migrations/2019_08_27_121924_combine_accounts_tables.php +++ /dev/null @@ -1,30 +0,0 @@ -boolean('activated')->default(1); - }); - - // Alter the default to 0 for new accounts - Schema::table('accounts', function (Blueprint $table) { - $table->boolean('activated')->default(0)->change(); - }); - } - - // No drop method because this isn't really reversible -} diff --git a/database/migrations/2019_09_04_153202_add_discourse_group_column.php b/database/migrations/2019_09_04_153202_add_discourse_group_column.php deleted file mode 100644 index 2ec1afda0..000000000 --- a/database/migrations/2019_09_04_153202_add_discourse_group_column.php +++ /dev/null @@ -1,32 +0,0 @@ -string('discourse_name')->nullable(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('groups', function (Blueprint $table) { - $table->dropColumn('discourse_name'); - }); - } -} diff --git a/database/migrations/2019_10_06_045949_create_donation_perks.php b/database/migrations/2019_10_06_045949_create_donation_perks.php deleted file mode 100644 index bef026279..000000000 --- a/database/migrations/2019_10_06_045949_create_donation_perks.php +++ /dev/null @@ -1,42 +0,0 @@ -bigIncrements('donation_perks_id'); - $table->integer('donation_id')->unsigned(); - $table->integer('account_id')->unsigned(); - $table->boolean('is_active'); - $table->boolean('is_lifetime_perks')->default(false); - $table->dateTime('expires_at')->nullable(); - $table->timestamps(); - - $table->foreign('donation_id')->references('donation_id')->on('donations'); - $table->foreign('account_id')->references('account_id')->on('accounts'); - }); - - // SQLite doesn't like multiple dropColumn() in a single operation - Schema::table('donations', function (Blueprint $table) { - $table->dropColumn('perks_end_at'); - }); - Schema::table('donations', function (Blueprint $table) { - $table->dropColumn('is_lifetime_perks'); - }); - Schema::table('donations', function (Blueprint $table) { - $table->dropColumn('is_active'); - }); - } - - // No drop method because this isn't reversible -} diff --git a/database/migrations/2019_10_14_122946_create_stripe_sessions.php b/database/migrations/2019_10_14_122946_create_stripe_sessions.php deleted file mode 100644 index bcd61bfc3..000000000 --- a/database/migrations/2019_10_14_122946_create_stripe_sessions.php +++ /dev/null @@ -1,36 +0,0 @@ -bigIncrements('account_payment_session_id'); - $table->uuid('session_id')->comment('Unique session ID sent to the third party that we can lookup later to fulfill a purchase'); - $table->integer('account_id')->unsigned()->nullable(); - $table->boolean('is_processed')->comment('Whether Stripe has notified us that the payment has been processed'); - $table->timestamps(); - - $table->index('session_id'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('account_payment_sessions'); - } -} diff --git a/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php b/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php deleted file mode 100644 index 3ce00023a..000000000 --- a/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php +++ /dev/null @@ -1,36 +0,0 @@ -bigIncrements('id'); - $table->morphs('tokenable'); - $table->string('name'); - $table->string('token', 64)->unique(); - $table->text('abilities')->nullable(); - $table->timestamp('last_used_at')->nullable(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('personal_access_tokens'); - } -} diff --git a/database/migrations/2020_03_22_113534_add_panel_access_column_to_groups.php b/database/migrations/2020_03_22_113534_add_panel_access_column_to_groups.php deleted file mode 100644 index f92f29054..000000000 --- a/database/migrations/2020_03_22_113534_add_panel_access_column_to_groups.php +++ /dev/null @@ -1,32 +0,0 @@ -boolean('can_access_panel')->default(false); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('groups', function (Blueprint $table) { - $table->dropColumn('can_access_panel'); - }); - } -} diff --git a/database/migrations/2020_12_23_210328_delete_players_minecraft_playtime.php b/database/migrations/2020_12_23_210328_delete_players_minecraft_playtime.php deleted file mode 100644 index 583e8611d..000000000 --- a/database/migrations/2020_12_23_210328_delete_players_minecraft_playtime.php +++ /dev/null @@ -1,32 +0,0 @@ -dropColumn('playtime'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('players_minecraft', function (Blueprint $table) { - $table->integer('playtime')->unsigned()->comment('Total playtime in minutes'); - }); - } -} diff --git a/database/migrations/2020_12_23_210456_rename_players_minecraft_last_seen_at.php b/database/migrations/2020_12_23_210456_rename_players_minecraft_last_seen_at.php deleted file mode 100644 index fd81f8e29..000000000 --- a/database/migrations/2020_12_23_210456_rename_players_minecraft_last_seen_at.php +++ /dev/null @@ -1,32 +0,0 @@ -renameColumn('last_seen_at', 'last_synced_at'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('players_minecraft', function (Blueprint $table) { - $table->renameColumn('last_synced_at', 'last_seen_at'); - }); - } -} diff --git a/database/migrations/2020_12_23_210633_make_nullable_players_minecraft_last_synced_at.php b/database/migrations/2020_12_23_210633_make_nullable_players_minecraft_last_synced_at.php deleted file mode 100644 index 14853c608..000000000 --- a/database/migrations/2020_12_23_210633_make_nullable_players_minecraft_last_synced_at.php +++ /dev/null @@ -1,32 +0,0 @@ -dateTime('last_synced_at')->nullable(true)->change(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('players_minecraft', function (Blueprint $table) { - $table->dateTime('last_synced_at')->nullable(false)->change(); - }); - } -} diff --git a/database/migrations/2020_12_24_163432_add_2fa_fields_to_accounts.php b/database/migrations/2020_12_24_163432_add_2fa_fields_to_accounts.php deleted file mode 100644 index 7c0dea590..000000000 --- a/database/migrations/2020_12_24_163432_add_2fa_fields_to_accounts.php +++ /dev/null @@ -1,38 +0,0 @@ -text('totp_secret')->nullable(); - $table->text('totp_backup_code')->nullable(); - $table->boolean('is_totp_enabled')->default(false); - $table->integer('totp_last_used')->nullable(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('accounts', function (Blueprint $table) { - $table->dropColumn('totp_secret'); - $table->dropColumn('totp_backup_code'); - $table->dropColumn('is_totp_enabled'); - $table->dropColumn('totp_last_used'); - }); - } -} diff --git a/database/migrations/2021_07_28_132343_add_minecraft_group_names.php b/database/migrations/2021_07_28_132343_add_minecraft_group_names.php deleted file mode 100644 index 74b9dd99e..000000000 --- a/database/migrations/2021_07_28_132343_add_minecraft_group_names.php +++ /dev/null @@ -1,34 +0,0 @@ -string('minecraft_name')->after('discourse_name')->nullable(); - $table->string('discord_name')->after('minecraft_name')->nullable(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('groups', function (Blueprint $table) { - $table->dropColumn('discord_name'); - $table->dropColumn('minecraft_name'); - }); - } -} diff --git a/database/migrations/2021_07_31_134903_create_donation_tiers.php b/database/migrations/2021_07_31_134903_create_donation_tiers.php deleted file mode 100644 index 9720255f4..000000000 --- a/database/migrations/2021_07_31_134903_create_donation_tiers.php +++ /dev/null @@ -1,40 +0,0 @@ -increments('donation_tier_id'); - $table->string('name'); - }); - - Schema::table('donation_perks', function (Blueprint $table) { - $table->integer('donation_tier_id')->after('donation_id')->nullable()->unsigned(); - $table->foreign('donation_tier_id')->references('donation_tier_id')->on('donation_tiers'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('donation_perks', function (Blueprint $table) { - $table->dropColumn('donation_tier_id'); - }); - - Schema::dropIfExists('donation_tiers'); - } -} diff --git a/database/migrations/2021_07_31_134904_migrate_lifetime_donors.php b/database/migrations/2021_07_31_134904_migrate_lifetime_donors.php deleted file mode 100644 index 54448822b..000000000 --- a/database/migrations/2021_07_31_134904_migrate_lifetime_donors.php +++ /dev/null @@ -1,105 +0,0 @@ - 0) { - $this->migrateLifetimeDonorsToLegacyRank(); - $this->migrateCurrentDonorsToTiers(); - } - } - - private function migrateLifetimeDonorsToLegacyRank() - { - DB::beginTransaction(); - - try { - // Give the 'Legacy Lifetime Donor' rank to any account that currently - // has 'lifetime' donation perks - $legacyDonorRank = Group::where('minecraft_name', 'legacy-donor')->first(); - if ($legacyDonorRank === null) { - throw new \Exception('Could not find legacy donor rank'); - } - - $lifetimePerks = DonationPerk::where('is_lifetime_perks', true) - ->where('is_active', true) - ->whereNotNull('account_id') - ->with('account.groups') - ->get(); - - $resolvedAccountIds = []; - - foreach ($lifetimePerks as $lifetimePerk) { - $account = $lifetimePerk->account; - - if (in_array($account->getKey(), $resolvedAccountIds)) { - continue; - } - $account->groups()->attach($legacyDonorRank->getKey()); - - $lifetimePerk->is_active = false; - $lifetimePerk->save(); - - array_push($resolvedAccountIds, $account->getKey()); - } - - Schema::table('donation_perks', function (Blueprint $table) { - $table->dropColumn('is_lifetime_perks'); - }); - } catch (\Exception $e) { - DB::rollBack(); - } - - DB::commit(); - } - - private function migrateCurrentDonorsToTiers() - { - $copperTier = DonationTier::create([ - 'name' => 'copper', - ]); - DonationTier::create([ - 'name' => 'iron', - ]); - DonationTier::create([ - 'name' => 'diamond', - ]); - - $donationPerks = DonationPerk::where('is_active')->get(); - - DB::transaction(function () use ($donationPerks, $copperTier) { - foreach ($donationPerks as $donationPerk) { - $donationPerk->donation_tier_id = $copperTier->getKey(); - $donationPerk->save(); - } - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('donation_perks', function (Blueprint $table) { - $table->boolean('is_lifetime_perks')->after('is_active')->default(false); - }); - } -} diff --git a/database/migrations/2021_08_02_180000_create_customer_columns.php b/database/migrations/2021_08_02_180000_create_customer_columns.php deleted file mode 100644 index c8a23b962..000000000 --- a/database/migrations/2021_08_02_180000_create_customer_columns.php +++ /dev/null @@ -1,42 +0,0 @@ -string('stripe_id')->nullable()->index(); - $table->string('pm_type')->nullable(); - $table->string('pm_last_four', 4)->nullable(); - $table->timestamp('trial_ends_at')->nullable(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('accounts', function (Blueprint $table) { - $table->dropColumn([ - 'stripe_id', - 'pm_type', - 'pm_last_four', - 'trial_ends_at', - ]); - }); - } -} diff --git a/database/migrations/2021_08_02_180001_create_subscriptions_table.php b/database/migrations/2021_08_02_180001_create_subscriptions_table.php deleted file mode 100644 index a965882db..000000000 --- a/database/migrations/2021_08_02_180001_create_subscriptions_table.php +++ /dev/null @@ -1,43 +0,0 @@ -bigIncrements('id'); - $table->unsignedBigInteger('account_account_id'); - $table->string('name'); - $table->string('stripe_id'); - $table->string('stripe_status'); - $table->string('stripe_price')->nullable(); - $table->integer('quantity')->nullable(); - $table->timestamp('trial_ends_at')->nullable(); - $table->timestamp('ends_at')->nullable(); - $table->timestamps(); - - $table->index(['account_account_id', 'stripe_status']); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('subscriptions'); - } -} diff --git a/database/migrations/2021_08_02_180002_create_subscription_items_table.php b/database/migrations/2021_08_02_180002_create_subscription_items_table.php deleted file mode 100644 index 08d34d703..000000000 --- a/database/migrations/2021_08_02_180002_create_subscription_items_table.php +++ /dev/null @@ -1,40 +0,0 @@ -bigIncrements('id'); - $table->unsignedBigInteger('subscription_id'); - $table->string('stripe_id')->index(); - $table->string('stripe_product'); - $table->string('stripe_price'); - $table->integer('quantity')->nullable(); - $table->timestamps(); - - $table->unique(['subscription_id', 'stripe_price']); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('subscription_items'); - } -} diff --git a/database/migrations/2021_08_04_163409_create_account_payments.php b/database/migrations/2021_08_04_163409_create_account_payments.php deleted file mode 100644 index d2f164b73..000000000 --- a/database/migrations/2021_08_04_163409_create_account_payments.php +++ /dev/null @@ -1,41 +0,0 @@ -bigIncrements('payment_id'); - $table->integer('account_id')->unsigned()->nullable(); - $table->string('stripe_price')->nullable(); // Nullable for backwards compatibility - $table->string('stripe_product')->nullable(); // Nullable for backwards compatibility - $table->integer('amount_paid_in_cents'); - $table->integer('quantity'); - $table->boolean('is_subscription_payment'); - $table->timestamps(); - - $table->index(['stripe_price', 'stripe_product']); - - $table->foreign('account_id')->references('account_id')->on('accounts'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('payments'); - } -} diff --git a/database/migrations/2021_08_20_130638_create_minecraft_loot_boxes.php b/database/migrations/2021_08_20_130638_create_minecraft_loot_boxes.php deleted file mode 100644 index 2daeba37a..000000000 --- a/database/migrations/2021_08_20_130638_create_minecraft_loot_boxes.php +++ /dev/null @@ -1,48 +0,0 @@ -increments('minecraft_loot_box_id'); - $table->integer('donation_tier_id')->unsigned(); - $table->string('loot_box_name'); - $table->integer('quantity'); - $table->boolean('is_active'); - $table->timestamps(); - - $table->foreign('donation_tier_id')->references('donation_tier_id')->on('donation_tiers'); - }); - - Schema::create('minecraft_redeemed_loot_boxes', function (Blueprint $table) { - $table->bigIncrements('redeemed_loot_box_id'); - $table->integer('account_id')->unsigned(); - $table->integer('minecraft_loot_box_id')->unsigned(); - $table->timestamp('created_at'); - - $table->foreign('account_id')->references('account_id')->on('accounts'); - $table->foreign('minecraft_loot_box_id')->references('minecraft_loot_box_id')->on('minecraft_loot_boxes'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('minecraft_redeemed_loot_boxes'); - Schema::dropIfExists('minecraft_loot_boxes'); - } -} diff --git a/database/migrations/2022_04_11_103651_remove_loot_boxes.php b/database/migrations/2022_04_11_103651_remove_loot_boxes.php deleted file mode 100644 index 547adb5e5..000000000 --- a/database/migrations/2022_04_11_103651_remove_loot_boxes.php +++ /dev/null @@ -1,48 +0,0 @@ -increments('minecraft_loot_box_id'); - $table->integer('donation_tier_id')->unsigned(); - $table->string('loot_box_name'); - $table->integer('quantity'); - $table->boolean('is_active'); - $table->timestamps(); - - $table->foreign('donation_tier_id')->references('donation_tier_id')->on('donation_tiers'); - }); - - Schema::create('minecraft_redeemed_loot_boxes', function (Blueprint $table) { - $table->bigIncrements('redeemed_loot_box_id'); - $table->integer('account_id')->unsigned(); - $table->integer('minecraft_loot_box_id')->unsigned(); - $table->timestamp('created_at'); - - $table->foreign('account_id')->references('account_id')->on('accounts'); - $table->foreign('minecraft_loot_box_id')->references('minecraft_loot_box_id')->on('minecraft_loot_boxes'); - }); - } -}; diff --git a/database/migrations/2022_04_12_145615_add_account_balance.php b/database/migrations/2022_04_12_145615_add_account_balance.php deleted file mode 100644 index 1fa2b11c6..000000000 --- a/database/migrations/2022_04_12_145615_add_account_balance.php +++ /dev/null @@ -1,32 +0,0 @@ -integer('balance')->unsigned()->default(0); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('accounts', function (Blueprint $table) { - $table->dropColumn('balance'); - }); - } -}; diff --git a/database/migrations/2022_04_12_152853_add_balance_transactions.php b/database/migrations/2022_04_12_152853_add_balance_transactions.php deleted file mode 100644 index a3de49dfc..000000000 --- a/database/migrations/2022_04_12_152853_add_balance_transactions.php +++ /dev/null @@ -1,38 +0,0 @@ -increments('balance_transaction_id'); - $table->integer('account_id')->unsigned(); - $table->integer('balance_before')->unsigned(); - $table->integer('balance_after')->unsigned(); - $table->integer('transaction_amount'); - $table->string('reason'); - $table->timestamp('created_at'); - - $table->foreign('account_id')->references('account_id')->on('accounts'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('account_balance_transactions'); - } -}; diff --git a/database/migrations/2022_04_19_120626_add_last_balance_date.php b/database/migrations/2022_04_19_120626_add_last_balance_date.php deleted file mode 100644 index d413afaf7..000000000 --- a/database/migrations/2022_04_19_120626_add_last_balance_date.php +++ /dev/null @@ -1,38 +0,0 @@ -dateTime('last_currency_reward_at')->nullable(); - }); - Schema::table('donation_tiers', function (Blueprint $table) { - $table->integer('currency_reward')->default(0); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('donation_tiers', function (Blueprint $table) { - $table->dropColumn('currency_reward'); - }); - Schema::table('donation_perks', function (Blueprint $table) { - $table->dropColumn('last_currency_reward_at'); - }); - } -}; diff --git a/database/migrations/2022_04_20_060549_create_product_table.php b/database/migrations/2022_04_20_060549_create_product_table.php deleted file mode 100644 index d80086f4c..000000000 --- a/database/migrations/2022_04_20_060549_create_product_table.php +++ /dev/null @@ -1,34 +0,0 @@ -string('price_id')->primary(); - $table->string('product_id'); - $table->integer('donation_tier_id')->nullable()->unsigned(); - - $table->foreign('donation_tier_id')->references('donation_tier_id')->on('donation_tiers'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('stripe_products'); - } -}; diff --git a/database/migrations/2022_05_09_132856_create_pages.php b/database/migrations/2022_05_09_132856_create_pages.php deleted file mode 100644 index 3ce35b856..000000000 --- a/database/migrations/2022_05_09_132856_create_pages.php +++ /dev/null @@ -1,36 +0,0 @@ -id('page_id'); - $table->string('url')->index(); - $table->string('title'); - $table->string('description'); - $table->text('contents'); - $table->boolean('is_draft')->default(1); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('pages'); - } -}; diff --git a/database/migrations/2022_05_13_170120_remove_server_status_players.php b/database/migrations/2022_05_13_170120_remove_server_status_players.php deleted file mode 100644 index ea6750370..000000000 --- a/database/migrations/2022_05_13_170120_remove_server_status_players.php +++ /dev/null @@ -1,36 +0,0 @@ -boolean('is_online')->after('display_order')->default(0); - $table->integer('num_of_players')->after('is_online')->default(0); - $table->integer('num_of_slots')->after('num_of_players')->default(0); - $table->dateTime('last_queried_at')->after('num_of_slots')->nullable(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - // No return from that - } -}; diff --git a/database/migrations/2022_05_15_134438_create_rank_applications.php b/database/migrations/2022_05_15_134438_create_rank_applications.php deleted file mode 100644 index 399c119dc..000000000 --- a/database/migrations/2022_05_15_134438_create_rank_applications.php +++ /dev/null @@ -1,40 +0,0 @@ -id(); - $table->integer('account_id')->unsigned(); - $table->string('minecraft_alias'); - $table->string('current_builder_rank'); - $table->string('build_location'); - $table->text('build_description'); - $table->text('additional_notes')->nullable(); - $table->integer('status'); - $table->text('denied_reason')->nullable(); - $table->dateTime('closed_at')->nullable(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('builder_rank_applications'); - } -}; diff --git a/database/migrations/2022_05_16_154731_add_builder_group_col.php b/database/migrations/2022_05_16_154731_add_builder_group_col.php deleted file mode 100644 index 2ded7178b..000000000 --- a/database/migrations/2022_05_16_154731_add_builder_group_col.php +++ /dev/null @@ -1,32 +0,0 @@ -boolean('is_build')->default(false)->after('alias'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('groups', function (Blueprint $table) { - $table->dropColumn('is_build'); - }); - } -}; diff --git a/database/migrations/2022_05_22_154628_create_ban_appeals_table.php b/database/migrations/2022_05_22_154628_create_ban_appeals_table.php deleted file mode 100644 index 6e5f14086..000000000 --- a/database/migrations/2022_05_22_154628_create_ban_appeals_table.php +++ /dev/null @@ -1,41 +0,0 @@ -id(); - $table->integer('game_ban_id')->unsigned(); - $table->foreign('game_ban_id')->references('game_ban_id')->on('game_network_bans'); - $table->boolean('is_account_verified'); - $table->string('email')->nullable(); - $table->text('explanation'); - $table->tinyInteger('status')->unsigned(); - $table->text('decision_note')->nullable(); - $table->timestamp('decided_at')->nullable(); - $table->integer('decider_account_id')->unsigned()->nullable(); - $table->foreign('decider_account_id')->references('account_id')->on('accounts'); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('ban_appeals'); - } -}; diff --git a/database/migrations/2022_05_28_164701_create_server_tokens.php b/database/migrations/2022_05_28_164701_create_server_tokens.php deleted file mode 100644 index 8cacada3b..000000000 --- a/database/migrations/2022_05_28_164701_create_server_tokens.php +++ /dev/null @@ -1,50 +0,0 @@ -increments('id'); - $table->string('token')->index(); - $table->integer('server_id')->unsigned(); - $table->string('description')->nullable(); - $table->timestamps(); - - $table->foreign('server_id')->references('server_id')->on('servers'); - }); - - Schema::create('server_token_scopes', function (Blueprint $table) { - $table->increments('id'); - $table->string('scope')->index(); - }); - - Schema::create('server_token_scopes_pivot', function (Blueprint $table) { - $table->id(); - $table->integer('token_id')->unsigned(); - $table->integer('scope_id')->unsigned(); - - $table->foreign('token_id')->references('id')->on('server_tokens'); - $table->foreign('scope_id')->references('id')->on('server_token_scopes'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('server_tokens'); - } -}; diff --git a/database/migrations/2022_06_02_163732_delete_account_links_and_ban_logs.php b/database/migrations/2022_06_02_163732_delete_account_links_and_ban_logs.php deleted file mode 100644 index 520d483fd..000000000 --- a/database/migrations/2022_06_02_163732_delete_account_links_and_ban_logs.php +++ /dev/null @@ -1,30 +0,0 @@ -increments('id'); - $table->string('scope')->index(); - }); - - Schema::create('group_scopes_pivot', function (Blueprint $table) { - $table->id(); - $table->integer('group_id')->unsigned(); - $table->integer('scope_id')->unsigned(); - - $table->foreign('group_id') - ->references('group_id') - ->on('groups') - ->onDelete('cascade'); - - $table->foreign('scope_id') - ->references('id') - ->on('group_scopes') - ->onDelete('cascade'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('group_scopes_pivot'); - Schema::dropIfExists('group_scopes'); - } -}; diff --git a/database/migrations/2022_06_05_153600_create_activity_log_table.php b/database/migrations/2022_06_05_153600_create_activity_log_table.php deleted file mode 100644 index 3a2e1188a..000000000 --- a/database/migrations/2022_06_05_153600_create_activity_log_table.php +++ /dev/null @@ -1,27 +0,0 @@ -create(config('activitylog.table_name'), function (Blueprint $table) { - $table->bigIncrements('id'); - $table->string('log_name')->nullable(); - $table->text('description'); - $table->nullableMorphs('subject', 'subject'); - $table->nullableMorphs('causer', 'causer'); - $table->json('properties')->nullable(); - $table->timestamps(); - $table->index('log_name'); - }); - } - - public function down() - { - Schema::connection(config('activitylog.database_connection'))->dropIfExists(config('activitylog.table_name')); - } -}; diff --git a/database/migrations/2022_06_05_153601_add_event_column_to_activity_log_table.php b/database/migrations/2022_06_05_153601_add_event_column_to_activity_log_table.php deleted file mode 100644 index 78d9a0e0a..000000000 --- a/database/migrations/2022_06_05_153601_add_event_column_to_activity_log_table.php +++ /dev/null @@ -1,22 +0,0 @@ -table(config('activitylog.table_name'), function (Blueprint $table) { - $table->string('event')->nullable()->after('subject_type'); - }); - } - - public function down() - { - Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) { - $table->dropColumn('event'); - }); - } -} diff --git a/database/migrations/2022_06_05_153602_add_batch_uuid_column_to_activity_log_table.php b/database/migrations/2022_06_05_153602_add_batch_uuid_column_to_activity_log_table.php deleted file mode 100644 index 320ef5cce..000000000 --- a/database/migrations/2022_06_05_153602_add_batch_uuid_column_to_activity_log_table.php +++ /dev/null @@ -1,22 +0,0 @@ -table(config('activitylog.table_name'), function (Blueprint $table) { - $table->uuid('batch_uuid')->nullable()->after('properties'); - }); - } - - public function down() - { - Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) { - $table->dropColumn('batch_uuid'); - }); - } -} diff --git a/database/migrations/2022_06_14_143430_add_player_last_seen_col.php b/database/migrations/2022_06_14_143430_add_player_last_seen_col.php deleted file mode 100644 index 510c67b3f..000000000 --- a/database/migrations/2022_06_14_143430_add_player_last_seen_col.php +++ /dev/null @@ -1,38 +0,0 @@ -timestamp('last_seen_at')->nullable()->after('last_synced_at'); - }); - - MinecraftPlayer::get()->each(function ($player) { - $player->last_seen_at = $player->last_synced_at; - $player->save(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('players_minecraft', function (Blueprint $table) { - $table->dropColumn('last_seen_at'); - }); - } -}; diff --git a/database/migrations/2022_06_19_140057_remove_game_account_type.php b/database/migrations/2022_06_19_140057_remove_game_account_type.php deleted file mode 100644 index 8987dc0f9..000000000 --- a/database/migrations/2022_06_19_140057_remove_game_account_type.php +++ /dev/null @@ -1,28 +0,0 @@ -dropColumn(['banned_player_type', 'staff_player_type']); - }); - - Schema::table('game_network_unbans', function (Blueprint $table) { - $table->dropColumn('staff_player_type'); - }); - - Schema::table('game_network_warnings', function (Blueprint $table) { - $table->dropColumn(['warned_player_type', 'staff_player_type']); - }); - } -}; diff --git a/database/migrations/2022_08_08_125414_add_badges.php b/database/migrations/2022_08_08_125414_add_badges.php deleted file mode 100644 index 1fe275a4f..000000000 --- a/database/migrations/2022_08_08_125414_add_badges.php +++ /dev/null @@ -1,39 +0,0 @@ -increments('id'); - $table->string('display_name'); - $table->string('unicode_icon'); - }); - - Schema::create('badges_pivot', function (Blueprint $table) { - $table->increments('id'); - $table->string('badge_id'); - $table->string('account_id'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('badges_pivot'); - Schema::dropIfExists('badges'); - } -}; diff --git a/database/migrations/2022_08_13_090330_rename_decider_account_to_decider_player.php b/database/migrations/2022_08_13_090330_rename_decider_account_to_decider_player.php deleted file mode 100644 index 20cd2a7d0..000000000 --- a/database/migrations/2022_08_13_090330_rename_decider_account_to_decider_player.php +++ /dev/null @@ -1,36 +0,0 @@ -dropForeign(['decider_account_id']); - $table->renameColumn('decider_account_id', 'decider_player_minecraft_id'); - $table->foreign('decider_player_minecraft_id')->references('player_minecraft_id')->on('players_minecraft'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('ban_appeals', function (Blueprint $table) { - $table->dropForeign(['decider_player_minecraft_id']); - $table->renameColumn('decider_player_minecraft_id', 'decider_account_id'); - $table->foreign('decider_account_id')->references('account_id')->on('accounts'); - }); - } -}; diff --git a/database/migrations/2022_08_15_151557_add_warp_showcase.php b/database/migrations/2022_08_15_151557_add_warp_showcase.php deleted file mode 100644 index f38f926af..000000000 --- a/database/migrations/2022_08_15_151557_add_warp_showcase.php +++ /dev/null @@ -1,44 +0,0 @@ -increments('id'); - $table->string('name'); - $table->string('title')->nullable(); - $table->text('description')->nullable(); - $table->string('creators')->nullable(); - $table->string('location_world'); - $table->double('location_x'); - $table->double('location_y'); - $table->double('location_z'); - $table->float('location_pitch'); - $table->float('location_yaw'); - $table->dateTime('built_at')->nullable(); - $table->timestamps(); - - $table->index('name'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('showcase_warps'); - } -}; diff --git a/database/migrations/2022_08_29_053247_cascade_account_deletion.php b/database/migrations/2022_08_29_053247_cascade_account_deletion.php deleted file mode 100644 index 0648e2c6e..000000000 --- a/database/migrations/2022_08_29_053247_cascade_account_deletion.php +++ /dev/null @@ -1,42 +0,0 @@ -dropForeign('groups_accounts_account_id_foreign'); - $table->foreign('account_id')->references('account_id')->on('accounts')->onDelete('cascade'); - }); - Schema::table('account_email_changes', function (Blueprint $table) { - $table->dropForeign('account_email_changes_account_id_foreign'); - $table->foreign('account_id')->references('account_id')->on('accounts')->onDelete('cascade'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('account_email_changes', function (Blueprint $table) { - $table->dropForeign('account_email_changes_account_id_foreign'); - $table->foreign('account_id')->references('account_id')->on('accounts'); - }); - Schema::table('groups_accounts', function (Blueprint $table) { - $table->dropForeign('groups_accounts_account_id_foreign'); - $table->foreign('account_id')->references('account_id')->on('accounts'); - }); - } -}; diff --git a/database/migrations/2022_09_06_031358_create_failed_jobs_table.php b/database/migrations/2022_09_06_031358_create_failed_jobs_table.php deleted file mode 100644 index 17191986b..000000000 --- a/database/migrations/2022_09_06_031358_create_failed_jobs_table.php +++ /dev/null @@ -1,36 +0,0 @@ -id(); - $table->string('uuid')->unique(); - $table->text('connection'); - $table->text('queue'); - $table->longText('payload'); - $table->longText('exception'); - $table->timestamp('failed_at')->useCurrent(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('failed_jobs'); - } -}; diff --git a/database/migrations/2022_09_09_044922_add_unban_cols_to_ban_table.php b/database/migrations/2022_09_09_044922_add_unban_cols_to_ban_table.php deleted file mode 100644 index b1b5692ce..000000000 --- a/database/migrations/2022_09_09_044922_add_unban_cols_to_ban_table.php +++ /dev/null @@ -1,42 +0,0 @@ -dropColumn('is_global_ban'); - $table->timestamp('unbanned_at')->nullable()->after('updated_at'); - $table->integer('unbanner_player_id')->unsigned()->nullable()->after('unbanned_at'); - $table->string('unban_type')->nullable()->after('unbanner_player_id'); - - $table->foreign('unbanner_player_id')->references('player_minecraft_id')->on('players_minecraft'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('game_network_bans', function (Blueprint $table) { - $table->boolean('is_global_ban')->default(true)->after('is_active'); - - $table->dropForeignIdFor('unbanner_player_id'); - $table->dropColumn('unbanned_at'); - $table->dropColumn('unbanner_player_id'); - $table->dropColumn('unban_type'); - }); - } -}; diff --git a/database/migrations/2022_09_09_045726_move_unbans_to_bans_table.php b/database/migrations/2022_09_09_045726_move_unbans_to_bans_table.php deleted file mode 100644 index 05ae7cfe5..000000000 --- a/database/migrations/2022_09_09_045726_move_unbans_to_bans_table.php +++ /dev/null @@ -1,71 +0,0 @@ -ban; - $ban->unbanned_at = $unban->created_at; - $ban->unbanner_player_id = $unban->staff_player_id; - $ban->unban_type = UnbanType::MANUAL->value; - $ban->save(); - } - - $bans = GamePlayerBan::where('is_active', false)->whereNull('expires_at')->get(); - foreach ($bans as $ban) { - $ban->unbanned_at = $ban->updated_at; - $ban->unban_type = UnbanType::MANUAL->value; - $ban->save(); - } - - $bans = GamePlayerBan::where('is_active', false)->whereNotNull('expires_at')->get(); - foreach ($bans as $ban) { - $ban->unbanned_at = $ban->expires_at; - $ban->unban_type = UnbanType::EXPIRED->value; - $ban->save(); - } - } - */ - - Schema::table('game_network_bans', function (Blueprint $table) { - $table->dropColumn('is_active'); - }); - - Schema::drop('game_network_unbans'); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::create('game_network_unbans', function (Blueprint $table) { - $table->increments('game_unban_id'); - $table->integer('game_ban_id')->unsigned(); - $table->integer('staff_player_id')->unsigned(); - $table->string('staff_player_type'); - $table->timestamps(); - - $table->foreign('game_ban_id')->references('game_ban_id')->on('game_network_bans'); - }); - - Schema::table('game_network_bans', function (Blueprint $table) { - $table->boolean('is_active')->default(true)->after('reason'); - }); - } -}; diff --git a/database/migrations/2022_09_10_044245_drop_server_keys.php b/database/migrations/2022_09_10_044245_drop_server_keys.php deleted file mode 100644 index 4c1d7391a..000000000 --- a/database/migrations/2022_09_10_044245_drop_server_keys.php +++ /dev/null @@ -1,38 +0,0 @@ -increments('server_key_id'); - $table->integer('server_id')->unsigned(); - $table->string('token'); - $table->boolean('can_local_ban')->default(true); - $table->boolean('can_global_ban')->default(false); - $table->boolean('can_warn')->default(true); - $table->timestamps(); - - $table->foreign('server_id')->references('server_id')->on('servers'); - }); - } -}; diff --git a/database/migrations/2022_09_12_034018_change_warnings_table.php b/database/migrations/2022_09_12_034018_change_warnings_table.php deleted file mode 100644 index d16a76c6b..000000000 --- a/database/migrations/2022_09_12_034018_change_warnings_table.php +++ /dev/null @@ -1,60 +0,0 @@ -dropForeign('game_network_warnings_server_id_foreign'); - $table->dropColumn('server_id'); - - $table->dropColumn('is_active'); - - $table->text('reason')->nullable(false)->change(); - $table->text('additional_info')->nullable()->after('reason'); - - $table->renameColumn(from: 'staff_player_id', to: 'warner_player_id'); - $table->renameColumn(from: 'game_warning_id', to: 'id'); - - $table->boolean('is_acknowledged')->default(false)->after('weight'); - $table->dateTime('acknowledged_at')->nullable()->after('is_acknowledged'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::rename(from: 'player_warnings', to: 'game_network_warnings'); - - Schema::table('game_network_warnings', function (Blueprint $table) { - $table->integer('server_id')->unsigned()->nullable()->after('game_warning_id'); - $table->foreign('server_id')->references('server_id')->on('servers'); - - $table->boolean('is_active')->default(true)->after('weight'); - - $table->text('reason')->nullable(true)->change(); - - $table->renameColumn(from: 'warner_player_id', to: 'staff_player_id'); - $table->renameColumn(from: 'id', to: 'game_warning_id'); - - $table->dropColumn('is_acknowledged'); - $table->dropColumn('acknowledged_at'); - $table->dropColumn('additional_info'); - }); - } -}; diff --git a/database/migrations/2022_09_15_070606_create_ip_ban_table.php b/database/migrations/2022_09_15_070606_create_ip_ban_table.php deleted file mode 100644 index dcedbe4eb..000000000 --- a/database/migrations/2022_09_15_070606_create_ip_ban_table.php +++ /dev/null @@ -1,42 +0,0 @@ -id(); - $table->integer('banner_player_id')->unsigned(); - $table->ipAddress(); - $table->string('reason'); - $table->timestamps(); - $table->timestamp('unbanned_at')->nullable(); - $table->integer('unbanner_player_id')->unsigned()->nullable(); - $table->string('unban_type')->nullable(); - - $table->foreign('unbanner_player_id')->references('player_minecraft_id')->on('players_minecraft'); - $table->index('ip_address'); - }); - Schema::rename(from: 'game_network_bans', to: 'game_player_bans'); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('game_ip_bans'); - Schema::rename(from: 'game_player_bans', to: 'game_network_bans'); - } -}; diff --git a/database/migrations/2022_09_19_052638_rename_staff_player_id.php b/database/migrations/2022_09_19_052638_rename_staff_player_id.php deleted file mode 100644 index 8b5138db7..000000000 --- a/database/migrations/2022_09_19_052638_rename_staff_player_id.php +++ /dev/null @@ -1,34 +0,0 @@ -renameColumn(from: 'staff_player_id', to: 'banner_player_id'); - $table->renameColumn(from: 'game_ban_id', to: 'id'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('game_player_bans', function (Blueprint $table) { - $table->renameColumn(from: 'banner_player_id', to: 'staff_player_id'); - $table->renameColumn(from: 'id', to: 'game_ban_id'); - }); - } -}; diff --git a/database/migrations/2024_08_18_155246_delete_pages.php b/database/migrations/2024_08_18_155246_delete_pages.php deleted file mode 100644 index ccbe041ee..000000000 --- a/database/migrations/2024_08_18_155246_delete_pages.php +++ /dev/null @@ -1,24 +0,0 @@ -dropForeign('servers_server_category_id_foreign'); - $table->dropColumn('server_category_id'); - }); - - Schema::drop('server_categories'); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - // - } -}; diff --git a/database/migrations/2024_09_03_133144_account_activation_tokens.php b/database/migrations/2024_09_03_133144_account_activation_tokens.php deleted file mode 100644 index 442579807..000000000 --- a/database/migrations/2024_09_03_133144_account_activation_tokens.php +++ /dev/null @@ -1,36 +0,0 @@ -bigIncrements('id'); - $table->string('token'); - $table->integer('account_id')->unsigned(); - $table->timestamps(); - $table->dateTime('expires_at'); - - $table->foreign('account_id') - ->references('account_id') - ->on('accounts'); - - $table->index('token'); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::drop('account_activations'); - } -}; diff --git a/database/migrations/2024_09_04_151106_add_password_reset_expiry.php b/database/migrations/2024_09_04_151106_add_password_reset_expiry.php deleted file mode 100644 index 8fb6b2f6b..000000000 --- a/database/migrations/2024_09_04_151106_add_password_reset_expiry.php +++ /dev/null @@ -1,37 +0,0 @@ -integer('account_id')->unsigned(); - $table->dateTime('expires_at'); - $table->renameColumn('created_at', 'created_at_tmp'); - $table->bigIncrements('id')->first(); - $table->timestamps(); - - $table->foreign('account_id') - ->references('account_id') - ->on('accounts'); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - - } -}; diff --git a/database/migrations/2024_09_07_101052_update_email_change.php b/database/migrations/2024_09_07_101052_update_email_change.php deleted file mode 100644 index e5091792f..000000000 --- a/database/migrations/2024_09_07_101052_update_email_change.php +++ /dev/null @@ -1,31 +0,0 @@ -dropColumn('email_previous'); - $table->renameColumn('email_new', 'email'); - $table->dropColumn('is_previous_confirmed'); - $table->dropColumn('is_new_confirmed'); - $table->renameColumn('account_email_change_id', 'id'); - $table->dateTime('expires_at'); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - // No return - the migrations will be squashed soon - } -}; diff --git a/database/migrations/2024_09_15_120334_add_badge_visibility.php b/database/migrations/2024_09_15_120334_add_badge_visibility.php deleted file mode 100644 index d1ae3f185..000000000 --- a/database/migrations/2024_09_15_120334_add_badge_visibility.php +++ /dev/null @@ -1,27 +0,0 @@ -boolean('list_hidden')->default(false); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - // - } -}; diff --git a/database/migrations/2024_10_02_100137_create_minecraft_registration.php b/database/migrations/2024_10_02_100137_create_minecraft_registration.php deleted file mode 100644 index 5db78e6b3..000000000 --- a/database/migrations/2024_10_02_100137_create_minecraft_registration.php +++ /dev/null @@ -1,37 +0,0 @@ -id(); - $table->string('email'); - $table->string('minecraft_uuid'); - $table->string('minecraft_alias'); - $table->string('code', length: 6); - $table->timestamps(); - $table->dateTime('expires_at'); - }); - - Schema::drop('minecraft_auth_codes'); - - Schema::drop('server_token_scopes_pivot'); - Schema::drop('server_token_scopes'); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - // Point of no return - } -}; diff --git a/database/migrations/2024_10_07_100758_remove_alias_table.php b/database/migrations/2024_10_07_100758_remove_alias_table.php deleted file mode 100644 index 69a415ba3..000000000 --- a/database/migrations/2024_10_07_100758_remove_alias_table.php +++ /dev/null @@ -1,39 +0,0 @@ -string('alias')->after('uuid')->nullable(); - }); - - MinecraftPlayer::chunk(200, function (Collection $players) { - foreach ($players as $player) { - $alias = MinecraftPlayerAlias::where('player_minecraft_id', $player->getKey())->first(); - if ($alias !== null) { - $player->alias = $alias->alias; - $player->save(); - } - } - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - // Point of no return - } -}; diff --git a/database/migrations/2024_10_07_144916_remove_default_group_members.php b/database/migrations/2024_10_07_144916_remove_default_group_members.php deleted file mode 100644 index f05415023..000000000 --- a/database/migrations/2024_10_07_144916_remove_default_group_members.php +++ /dev/null @@ -1,31 +0,0 @@ -first(); - - if ($defaultGroup === null) return; - - // Delete all members from the default group - DB::table('groups_accounts') - ->where('group_id', $defaultGroup->getKey()) - ->delete(); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - // Point of no return - } -}; diff --git a/database/migrations/2024_10_18_100146_add_server_query_port.php b/database/migrations/2024_10_18_100146_add_server_query_port.php deleted file mode 100644 index d76c58e89..000000000 --- a/database/migrations/2024_10_18_100146_add_server_query_port.php +++ /dev/null @@ -1,35 +0,0 @@ -dropColumn('display_order'); - $table->dropColumn('is_online'); - $table->dropColumn('num_of_players'); - $table->dropColumn('num_of_slots'); - $table->dropColumn('last_queried_at'); - $table->dropColumn('is_port_visible'); - $table->dropColumn('is_visible'); - $table->dropColumn('is_querying'); - $table->dropColumn('game_type'); - $table->string('web_port')->nullable()->after('port'); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - // - } -}; diff --git a/database/migrations/2024_10_25_083122_create_minecraft_config.php b/database/migrations/2024_10_25_083122_create_minecraft_config.php deleted file mode 100644 index 57b8c0c29..000000000 --- a/database/migrations/2024_10_25_083122_create_minecraft_config.php +++ /dev/null @@ -1,30 +0,0 @@ -id(); - $table->json('config'); - $table->integer('version'); - $table->timestamps(); - $table->softDeletes(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('minecraft_config'); - } -}; diff --git a/database/migrations/2024_10_28_110159_create_warps.php b/database/migrations/2024_10_28_110159_create_warps.php deleted file mode 100644 index 150884de8..000000000 --- a/database/migrations/2024_10_28_110159_create_warps.php +++ /dev/null @@ -1,40 +0,0 @@ -increments('id'); - $table->string('name'); - $table->string('world'); - $table->double('x'); - $table->double('y'); - $table->double('z'); - $table->float('pitch'); - $table->float('yaw'); - $table->timestamps(); - - $table->index('name'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('minecraft_warps'); - } -}; diff --git a/database/migrations/2024_10_30_110257_add_minecraft_group_cols.php b/database/migrations/2024_10_30_110257_add_minecraft_group_cols.php deleted file mode 100644 index f17db2fd9..000000000 --- a/database/migrations/2024_10_30_110257_add_minecraft_group_cols.php +++ /dev/null @@ -1,56 +0,0 @@ -dropColumn('discourse_name'); - $table->integer('display_priority')->nullable()->after('minecraft_name'); - $table->string('minecraft_hover_text')->after('minecraft_name'); - $table->string('minecraft_display_name')->after('minecraft_name'); - $table->string('group_type')->nullable(); - }); - - Schema::table('donation_perks', function (Blueprint $table) { - $table->dropColumn('last_currency_reward_at'); - }); - - Schema::table('donation_tiers', function (Blueprint $table) { - $table->dropColumn('currency_reward'); - $table->unsignedInteger('group_id')->nullable(); - - $table->foreign('group_id')->references('group_id')->on('groups'); - }); - - $group = Group::first(); - if ($group === null) { - $group = Group::factory()->create(); - } - DonationTier::get()->each(function ($tier) use($group) { - $tier->group_id = $group->getKey(); - $tier->save(); - }); - - Schema::table('donation_tiers', function (Blueprint $table) { - $table->unsignedInteger('group_id')->change(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - // - } -}; diff --git a/database/schema/mariadb-schema.sql b/database/schema/mariadb-schema.sql new file mode 100644 index 000000000..e61b22550 --- /dev/null +++ b/database/schema/mariadb-schema.sql @@ -0,0 +1,696 @@ +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `account_activations`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `account_activations` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `token` varchar(191) NOT NULL, + `account_id` int(10) unsigned NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `expires_at` datetime NOT NULL, + PRIMARY KEY (`id`), + KEY `account_activations_account_id_foreign` (`account_id`), + KEY `account_activations_token_index` (`token`), + CONSTRAINT `account_activations_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`account_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `account_balance_transactions`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `account_balance_transactions` ( + `balance_transaction_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `account_id` int(10) unsigned NOT NULL, + `balance_before` int(10) unsigned NOT NULL, + `balance_after` int(10) unsigned NOT NULL, + `transaction_amount` int(11) NOT NULL, + `reason` varchar(191) NOT NULL, + `created_at` timestamp NOT NULL, + PRIMARY KEY (`balance_transaction_id`), + KEY `account_balance_transactions_account_id_foreign` (`account_id`), + CONSTRAINT `account_balance_transactions_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`account_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `account_email_changes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `account_email_changes` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `account_id` int(10) unsigned NOT NULL, + `token` varchar(191) NOT NULL, + `email` varchar(191) NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `expires_at` datetime NOT NULL, + PRIMARY KEY (`id`), + KEY `account_email_changes_token_email_previous_email_new_index` (`token`,`email`), + KEY `account_email_changes_account_id_foreign` (`account_id`), + CONSTRAINT `account_email_changes_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`account_id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `account_password_resets`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `account_password_resets` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `email` varchar(191) NOT NULL, + `token` varchar(191) NOT NULL, + `created_at_tmp` timestamp NULL DEFAULT NULL, + `account_id` int(10) unsigned NOT NULL, + `expires_at` datetime NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `account_password_resets_email_index` (`email`), + KEY `account_password_resets_account_id_foreign` (`account_id`), + CONSTRAINT `account_password_resets_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`account_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `accounts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `accounts` ( + `account_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `email` varchar(191) NOT NULL, + `password` varchar(191) NOT NULL, + `remember_token` varchar(60) DEFAULT NULL, + `last_login_ip` varchar(45) DEFAULT NULL, + `last_login_at` timestamp NULL DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `username` varchar(191) DEFAULT NULL, + `activated` tinyint(1) NOT NULL DEFAULT 0, + `totp_secret` text DEFAULT NULL, + `totp_backup_code` text DEFAULT NULL, + `is_totp_enabled` tinyint(1) NOT NULL DEFAULT 0, + `totp_last_used` int(11) DEFAULT NULL, + `stripe_id` varchar(191) DEFAULT NULL, + `pm_type` varchar(191) DEFAULT NULL, + `pm_last_four` varchar(4) DEFAULT NULL, + `trial_ends_at` timestamp NULL DEFAULT NULL, + `balance` int(10) unsigned NOT NULL DEFAULT 0, + PRIMARY KEY (`account_id`), + KEY `accounts_stripe_id_index` (`stripe_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `activity_log`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `activity_log` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `log_name` varchar(191) DEFAULT NULL, + `description` text NOT NULL, + `subject_type` varchar(191) DEFAULT NULL, + `event` varchar(191) DEFAULT NULL, + `subject_id` bigint(20) unsigned DEFAULT NULL, + `causer_type` varchar(191) DEFAULT NULL, + `causer_id` bigint(20) unsigned DEFAULT NULL, + `properties` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`properties`)), + `batch_uuid` uuid DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `subject` (`subject_type`,`subject_id`), + KEY `causer` (`causer_type`,`causer_id`), + KEY `activity_log_log_name_index` (`log_name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `badges`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `badges` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `display_name` varchar(191) NOT NULL, + `unicode_icon` varchar(191) NOT NULL, + `list_hidden` tinyint(1) NOT NULL DEFAULT 0, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `badges_pivot`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `badges_pivot` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `badge_id` varchar(191) NOT NULL, + `account_id` varchar(191) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `ban_appeals`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `ban_appeals` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `game_ban_id` int(10) unsigned NOT NULL, + `is_account_verified` tinyint(1) NOT NULL, + `email` varchar(191) DEFAULT NULL, + `explanation` text NOT NULL, + `status` tinyint(3) unsigned NOT NULL, + `decision_note` text DEFAULT NULL, + `decided_at` timestamp NULL DEFAULT NULL, + `decider_player_minecraft_id` int(10) unsigned DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `ban_appeals_game_ban_id_foreign` (`game_ban_id`), + KEY `ban_appeals_decider_player_minecraft_id_foreign` (`decider_player_minecraft_id`), + CONSTRAINT `ban_appeals_decider_player_minecraft_id_foreign` FOREIGN KEY (`decider_player_minecraft_id`) REFERENCES `players_minecraft` (`player_minecraft_id`), + CONSTRAINT `ban_appeals_game_ban_id_foreign` FOREIGN KEY (`game_ban_id`) REFERENCES `game_player_bans` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `builder_rank_applications`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `builder_rank_applications` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `account_id` int(10) unsigned NOT NULL, + `minecraft_alias` varchar(191) NOT NULL, + `current_builder_rank` varchar(191) NOT NULL, + `build_location` varchar(191) NOT NULL, + `build_description` text NOT NULL, + `additional_notes` text DEFAULT NULL, + `status` int(11) NOT NULL, + `denied_reason` text DEFAULT NULL, + `closed_at` datetime DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `donation_perks`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `donation_perks` ( + `donation_perks_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `donation_id` int(10) unsigned NOT NULL, + `donation_tier_id` int(10) unsigned DEFAULT NULL, + `account_id` int(10) unsigned NOT NULL, + `is_active` tinyint(1) NOT NULL, + `is_lifetime_perks` tinyint(1) NOT NULL DEFAULT 0, + `expires_at` datetime DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`donation_perks_id`), + KEY `donation_perks_donation_id_foreign` (`donation_id`), + KEY `donation_perks_account_id_foreign` (`account_id`), + KEY `donation_perks_donation_tier_id_foreign` (`donation_tier_id`), + CONSTRAINT `donation_perks_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`account_id`), + CONSTRAINT `donation_perks_donation_id_foreign` FOREIGN KEY (`donation_id`) REFERENCES `donations` (`donation_id`), + CONSTRAINT `donation_perks_donation_tier_id_foreign` FOREIGN KEY (`donation_tier_id`) REFERENCES `donation_tiers` (`donation_tier_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `donation_tiers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `donation_tiers` ( + `donation_tier_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(191) NOT NULL, + `group_id` int(10) unsigned NOT NULL, + PRIMARY KEY (`donation_tier_id`), + KEY `donation_tiers_group_id_foreign` (`group_id`), + CONSTRAINT `donation_tiers_group_id_foreign` FOREIGN KEY (`group_id`) REFERENCES `groups` (`group_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `donations`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `donations` ( + `donation_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `account_id` int(10) unsigned DEFAULT NULL, + `amount` double NOT NULL COMMENT 'Amount donated in dollars', + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`donation_id`), + KEY `donations_perks_end_at_amount_index` (`amount`), + KEY `donations_account_id_foreign` (`account_id`), + CONSTRAINT `donations_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`account_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `failed_jobs`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `failed_jobs` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `uuid` varchar(191) NOT NULL, + `connection` text NOT NULL, + `queue` text NOT NULL, + `payload` longtext NOT NULL, + `exception` longtext NOT NULL, + `failed_at` timestamp NOT NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `game_ip_bans`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `game_ip_bans` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `banner_player_id` int(10) unsigned NOT NULL, + `ip_address` varchar(45) NOT NULL, + `reason` varchar(191) NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `unbanned_at` timestamp NULL DEFAULT NULL, + `unbanner_player_id` int(10) unsigned DEFAULT NULL, + `unban_type` varchar(191) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `game_ip_bans_unbanner_player_id_foreign` (`unbanner_player_id`), + KEY `game_ip_bans_ip_address_index` (`ip_address`), + CONSTRAINT `game_ip_bans_unbanner_player_id_foreign` FOREIGN KEY (`unbanner_player_id`) REFERENCES `players_minecraft` (`player_minecraft_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `game_player_bans`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `game_player_bans` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `server_id` int(10) unsigned DEFAULT NULL, + `banned_player_id` int(10) unsigned NOT NULL, + `banned_alias_at_time` varchar(191) NOT NULL COMMENT 'Alias of the player at ban time for logging purposes', + `banner_player_id` int(10) unsigned DEFAULT NULL, + `reason` text DEFAULT NULL, + `expires_at` timestamp NULL DEFAULT NULL COMMENT 'Date that this ban auto-expires on', + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `unbanned_at` timestamp NULL DEFAULT NULL, + `unbanner_player_id` int(10) unsigned DEFAULT NULL, + `unban_type` varchar(191) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `game_network_bans_unbanner_player_id_foreign` (`unbanner_player_id`), + CONSTRAINT `game_network_bans_unbanner_player_id_foreign` FOREIGN KEY (`unbanner_player_id`) REFERENCES `players_minecraft` (`player_minecraft_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `group_scopes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `group_scopes` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `scope` varchar(191) NOT NULL, + PRIMARY KEY (`id`), + KEY `group_scopes_scope_index` (`scope`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `group_scopes_pivot`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `group_scopes_pivot` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `group_id` int(10) unsigned NOT NULL, + `scope_id` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `group_scopes_pivot_group_id_foreign` (`group_id`), + KEY `group_scopes_pivot_scope_id_foreign` (`scope_id`), + CONSTRAINT `group_scopes_pivot_group_id_foreign` FOREIGN KEY (`group_id`) REFERENCES `groups` (`group_id`) ON DELETE CASCADE, + CONSTRAINT `group_scopes_pivot_scope_id_foreign` FOREIGN KEY (`scope_id`) REFERENCES `group_scopes` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `groups`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `groups` ( + `group_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(191) NOT NULL, + `alias` varchar(191) DEFAULT NULL, + `is_build` tinyint(1) NOT NULL DEFAULT 0, + `is_default` tinyint(1) NOT NULL DEFAULT 0, + `is_staff` tinyint(1) NOT NULL DEFAULT 0, + `is_admin` tinyint(1) NOT NULL DEFAULT 0, + `minecraft_name` varchar(191) DEFAULT NULL, + `minecraft_display_name` varchar(191) NOT NULL, + `minecraft_hover_text` varchar(191) NOT NULL, + `display_priority` int(11) DEFAULT NULL, + `discord_name` varchar(191) DEFAULT NULL, + `can_access_panel` tinyint(1) NOT NULL DEFAULT 0, + `group_type` varchar(191) DEFAULT NULL, + PRIMARY KEY (`group_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `groups_accounts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `groups_accounts` ( + `groups_accounts_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `group_id` int(10) unsigned NOT NULL, + `account_id` int(10) unsigned NOT NULL, + PRIMARY KEY (`groups_accounts_id`), + KEY `groups_accounts_group_id_foreign` (`group_id`), + KEY `groups_accounts_account_id_foreign` (`account_id`), + CONSTRAINT `groups_accounts_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`account_id`) ON DELETE CASCADE, + CONSTRAINT `groups_accounts_group_id_foreign` FOREIGN KEY (`group_id`) REFERENCES `groups` (`group_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `jobs`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `jobs` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `queue` varchar(191) NOT NULL, + `payload` longtext NOT NULL, + `attempts` 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, + PRIMARY KEY (`id`), + KEY `jobs_queue_index` (`queue`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `migrations`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `migrations` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `migration` varchar(191) NOT NULL, + `batch` int(11) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `minecraft_config`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `minecraft_config` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `config` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`config`)), + `version` int(11) NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `deleted_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `minecraft_registrations`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `minecraft_registrations` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `email` varchar(191) NOT NULL, + `minecraft_uuid` varchar(191) NOT NULL, + `minecraft_alias` varchar(191) NOT NULL, + `code` varchar(6) NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `expires_at` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `minecraft_warps`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `minecraft_warps` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(191) NOT NULL, + `world` varchar(191) NOT NULL, + `x` double NOT NULL, + `y` double NOT NULL, + `z` double NOT NULL, + `pitch` double NOT NULL, + `yaw` double NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `minecraft_warps_name_index` (`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `payments`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `payments` ( + `payment_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `account_id` int(10) unsigned DEFAULT NULL, + `stripe_price` varchar(191) DEFAULT NULL, + `stripe_product` varchar(191) DEFAULT NULL, + `amount_paid_in_cents` int(11) NOT NULL, + `quantity` int(11) NOT NULL, + `is_subscription_payment` tinyint(1) NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`payment_id`), + KEY `payments_stripe_price_stripe_product_index` (`stripe_price`,`stripe_product`), + KEY `payments_account_id_foreign` (`account_id`), + CONSTRAINT `payments_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`account_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `personal_access_tokens`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `personal_access_tokens` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `tokenable_type` varchar(191) NOT NULL, + `tokenable_id` bigint(20) unsigned NOT NULL, + `name` varchar(191) NOT NULL, + `token` varchar(64) NOT NULL, + `abilities` text DEFAULT NULL, + `last_used_at` timestamp NULL DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `personal_access_tokens_token_unique` (`token`), + KEY `personal_access_tokens_tokenable_type_tokenable_id_index` (`tokenable_type`,`tokenable_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `player_warnings`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `player_warnings` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `warned_player_id` int(10) unsigned NOT NULL, + `warner_player_id` int(10) unsigned DEFAULT NULL, + `reason` text NOT NULL, + `additional_info` text DEFAULT NULL, + `weight` int(11) NOT NULL COMMENT 'How many points the infraction is worth', + `is_acknowledged` tinyint(1) NOT NULL DEFAULT 0, + `acknowledged_at` datetime DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `players_minecraft`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `players_minecraft` ( + `player_minecraft_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `uuid` varchar(60) NOT NULL, + `alias` varchar(191) DEFAULT NULL, + `account_id` int(10) unsigned DEFAULT NULL, + `last_synced_at` datetime DEFAULT NULL, + `last_seen_at` timestamp NULL DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`player_minecraft_id`), + UNIQUE KEY `players_minecraft_uuid_unique` (`uuid`), + KEY `players_minecraft_uuid_index` (`uuid`), + KEY `players_minecraft_account_id_foreign` (`account_id`), + CONSTRAINT `players_minecraft_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`account_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `players_minecraft_aliases`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `players_minecraft_aliases` ( + `players_minecraft_alias_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `player_minecraft_id` int(10) unsigned NOT NULL, + `alias` varchar(191) NOT NULL, + `registered_at` timestamp NULL DEFAULT NULL COMMENT 'The actual datetime they changed their alias to this', + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`players_minecraft_alias_id`), + KEY `players_minecraft_aliases_alias_index` (`alias`), + KEY `players_minecraft_aliases_player_minecraft_id_foreign` (`player_minecraft_id`), + CONSTRAINT `players_minecraft_aliases_player_minecraft_id_foreign` FOREIGN KEY (`player_minecraft_id`) REFERENCES `players_minecraft` (`player_minecraft_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `server_tokens`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `server_tokens` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `token` varchar(191) NOT NULL, + `server_id` int(10) unsigned NOT NULL, + `description` varchar(191) DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `server_tokens_server_id_foreign` (`server_id`), + KEY `server_tokens_token_index` (`token`), + CONSTRAINT `server_tokens_server_id_foreign` FOREIGN KEY (`server_id`) REFERENCES `servers` (`server_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `servers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `servers` ( + `server_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(191) NOT NULL, + `ip` varchar(191) NOT NULL, + `ip_alias` varchar(191) DEFAULT NULL COMMENT 'An alternative address to connect to the server', + `port` varchar(191) DEFAULT NULL, + `web_port` varchar(191) DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`server_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `showcase_warps`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `showcase_warps` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(191) NOT NULL, + `title` varchar(191) DEFAULT NULL, + `description` text DEFAULT NULL, + `creators` varchar(191) DEFAULT NULL, + `location_world` varchar(191) NOT NULL, + `location_x` double NOT NULL, + `location_y` double NOT NULL, + `location_z` double NOT NULL, + `location_pitch` double NOT NULL, + `location_yaw` double NOT NULL, + `built_at` datetime DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `showcase_warps_name_index` (`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `stripe_products`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `stripe_products` ( + `price_id` varchar(191) NOT NULL, + `product_id` varchar(191) NOT NULL, + `donation_tier_id` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`price_id`), + KEY `stripe_products_donation_tier_id_foreign` (`donation_tier_id`), + CONSTRAINT `stripe_products_donation_tier_id_foreign` FOREIGN KEY (`donation_tier_id`) REFERENCES `donation_tiers` (`donation_tier_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `subscription_items`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `subscription_items` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `subscription_id` bigint(20) unsigned NOT NULL, + `stripe_id` varchar(191) NOT NULL, + `stripe_product` varchar(191) NOT NULL, + `stripe_price` varchar(191) NOT NULL, + `quantity` int(11) DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `subscription_items_subscription_id_stripe_price_unique` (`subscription_id`,`stripe_price`), + KEY `subscription_items_stripe_id_index` (`stripe_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `subscriptions`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `subscriptions` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `account_account_id` bigint(20) unsigned NOT NULL, + `name` varchar(191) NOT NULL, + `stripe_id` varchar(191) NOT NULL, + `stripe_status` varchar(191) NOT NULL, + `stripe_price` varchar(191) DEFAULT NULL, + `quantity` int(11) DEFAULT NULL, + `trial_ends_at` timestamp NULL DEFAULT NULL, + `ends_at` timestamp NULL DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `subscriptions_account_account_id_stripe_status_index` (`account_account_id`,`stripe_status`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (1,'2017_09_15_131358_create_users',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (2,'2017_09_15_154714_create_servers',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (3,'2017_09_17_142032_create_bans',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (4,'2017_10_03_124225_create_donations',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (5,'2017_10_14_134236_create_jobs_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (6,'2018_03_21_102044_create_user_register_emails',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (7,'2018_03_22_153113_create_account_oauth',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (8,'2018_03_27_142354_create_password_resets_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (9,'2018_04_20_141003_alter_donations',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (10,'2018_06_30_090859_create_email_change',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (11,'2018_07_09_032541_alter_account_links_add_email',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (12,'2018_08_17_173709_create_payments',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (13,'2018_08_22_153055_create_player_warnings',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (14,'2018_08_23_141229_delete_server_tokens',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (15,'2018_09_02_034512_allow_null_ban_staff',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (16,'2018_09_09_032458_create_groups',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (17,'2019_05_26_081858_create_minecraft_auth_codes',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (18,'2019_07_27_183009_add_username_to_accounts',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (19,'2019_07_28_125054_add_username_to_unactivated_accounts',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (20,'2019_08_27_121924_combine_accounts_tables',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (21,'2019_09_04_153202_add_discourse_group_column',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (22,'2019_10_06_045949_create_donation_perks',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (23,'2019_10_14_122946_create_stripe_sessions',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (24,'2019_12_14_000001_create_personal_access_tokens_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (25,'2020_03_22_113534_add_panel_access_column_to_groups',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (26,'2020_12_23_210328_delete_players_minecraft_playtime',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (27,'2020_12_23_210456_rename_players_minecraft_last_seen_at',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (28,'2020_12_23_210633_make_nullable_players_minecraft_last_synced_at',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (29,'2020_12_24_163432_add_2fa_fields_to_accounts',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (30,'2021_07_28_132343_add_minecraft_group_names',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (31,'2021_07_31_134903_create_donation_tiers',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (32,'2021_07_31_134904_migrate_lifetime_donors',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (33,'2021_08_02_180000_create_customer_columns',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (34,'2021_08_02_180001_create_subscriptions_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (35,'2021_08_02_180002_create_subscription_items_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (36,'2021_08_04_163409_create_account_payments',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (37,'2021_08_20_130638_create_minecraft_loot_boxes',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (38,'2022_04_11_103651_remove_loot_boxes',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (39,'2022_04_12_145615_add_account_balance',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (40,'2022_04_12_152853_add_balance_transactions',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (41,'2022_04_19_120626_add_last_balance_date',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (42,'2022_04_20_060549_create_product_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (43,'2022_05_09_132856_create_pages',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (44,'2022_05_13_170120_remove_server_status_players',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (45,'2022_05_15_134438_create_rank_applications',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (46,'2022_05_16_154731_add_builder_group_col',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (47,'2022_05_22_154628_create_ban_appeals_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (48,'2022_05_28_164701_create_server_tokens',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (49,'2022_06_02_163732_delete_account_links_and_ban_logs',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (50,'2022_06_03_132514_create_group_scopes',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (51,'2022_06_05_153600_create_activity_log_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (52,'2022_06_05_153601_add_event_column_to_activity_log_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (53,'2022_06_05_153602_add_batch_uuid_column_to_activity_log_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (54,'2022_06_14_143430_add_player_last_seen_col',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (55,'2022_06_19_140057_remove_game_account_type',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (56,'2022_08_08_125414_add_badges',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (57,'2022_08_13_090330_rename_decider_account_to_decider_player',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (58,'2022_08_15_151557_add_warp_showcase',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (59,'2022_08_29_053247_cascade_account_deletion',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (60,'2022_09_06_031358_create_failed_jobs_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (61,'2022_09_09_044922_add_unban_cols_to_ban_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (62,'2022_09_09_045726_move_unbans_to_bans_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (63,'2022_09_10_044245_drop_server_keys',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (64,'2022_09_12_034018_change_warnings_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (65,'2022_09_15_070606_create_ip_ban_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (66,'2022_09_19_052638_rename_staff_player_id',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (67,'2024_08_18_155246_delete_pages',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (68,'2024_08_19_113119_delete_server_categories',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (69,'2024_09_03_133144_account_activation_tokens',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (70,'2024_09_04_151106_add_password_reset_expiry',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (71,'2024_09_07_101052_update_email_change',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (72,'2024_09_15_120334_add_badge_visibility',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (73,'2024_10_02_100137_create_minecraft_registration',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (74,'2024_10_07_100758_remove_alias_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (75,'2024_10_07_144916_remove_default_group_members',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (76,'2024_10_18_100146_add_server_query_port',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (77,'2024_10_25_083122_create_minecraft_config',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (78,'2024_10_28_110159_create_warps',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (79,'2024_10_30_110257_add_minecraft_group_cols',1); diff --git a/database/seeders/AccountSeeder.php b/database/seeders/AccountSeeder.php index c07ac3317..9cedc6b36 100644 --- a/database/seeders/AccountSeeder.php +++ b/database/seeders/AccountSeeder.php @@ -59,7 +59,7 @@ private function createDummyAccounts() { Account::factory() ->passwordHashed('password') - ->count(100) + ->count(50) ->create(); } } diff --git a/database/seeders/BadgeSeeder.php b/database/seeders/BadgeSeeder.php index 66cdf7d26..7ec85325e 100644 --- a/database/seeders/BadgeSeeder.php +++ b/database/seeders/BadgeSeeder.php @@ -20,11 +20,11 @@ public function run() 'unicode_icon' => '✦', ]); - Badge::factory(50)->create(); + Badge::factory(30)->create(); $account = Account::where('email', 'admin@pcbmc.co')->first(); - for ($i = 0; $i <= 15; $i++) { - $account->badges()->attach(Badge::where('id', $i)->first()); - } + $account->badges()->sync( + Badge::where('id', '<=', 6)->get() + ); } } diff --git a/database/seeders/BanAppealSeeder.php b/database/seeders/BanAppealSeeder.php deleted file mode 100644 index 1fb13bd42..000000000 --- a/database/seeders/BanAppealSeeder.php +++ /dev/null @@ -1,13 +0,0 @@ -call(ServerSeeder::class); + Server::factory()->create([ + 'name' => 'Minecraft (Java)', + 'ip' => 'host.docker.internal', + 'ip_alias' => 'pcbmc.co', + 'port' => '25565', + 'web_port' => '8080', + ]); + $this->call(GroupSeeder::class); $this->call(AccountSeeder::class); $this->call(MinecraftPlayerSeeder::class); @@ -20,7 +28,6 @@ public function run() $this->call(PlayerWarningSeeder::class); $this->call(DonationSeeder::class); $this->call(BadgeSeeder::class); - $this->call(ShowcaseWarpSeeder::class); ServerToken::create([ 'token' => 'pcbridge_local', @@ -31,8 +38,12 @@ public function run() MinecraftConfig::factory() ->create(); + ShowcaseWarp::factory() + ->count(50) + ->create(); + MinecraftWarp::factory() - ->count(40) + ->count(50) ->create(); } } diff --git a/database/seeders/GameBanSeeder.php b/database/seeders/GameBanSeeder.php index 08664605b..99914b141 100644 --- a/database/seeders/GameBanSeeder.php +++ b/database/seeders/GameBanSeeder.php @@ -20,7 +20,7 @@ public function run() $players = MinecraftPlayer::get(); - for ($i = 0; $i < 100; $i++) { + for ($i = 0; $i < 50; $i++) { GamePlayerBan::factory() ->bannedPlayer($players->random()) ->bannedBy($staffPlayers->random()) diff --git a/database/seeders/MinecraftPlayerSeeder.php b/database/seeders/MinecraftPlayerSeeder.php index 177bff4ae..d1a3c25cd 100644 --- a/database/seeders/MinecraftPlayerSeeder.php +++ b/database/seeders/MinecraftPlayerSeeder.php @@ -4,28 +4,18 @@ use App\Models\Account; use App\Models\MinecraftPlayer; -use App\Models\MinecraftPlayerAlias; use Illuminate\Database\Seeder; class MinecraftPlayerSeeder extends Seeder { public function run() { - $accounts = Account::get(); - - $j = 0; - for ($i = 0; $i < 100; $i++) { - $player = MinecraftPlayer::factory() + for ($i = 0; $i < 50; $i++) { + MinecraftPlayer::factory() ->for(Account::factory(), 'account') - ->create([ - 'account_id' => (rand(0, 1) === 1) ? $accounts[$j++]->getKey() : null, - ]); - - if (rand(0, 1) === 1) { - MinecraftPlayerAlias::factory() - ->for($player, 'minecraftPlayer') - ->create(); - } + ->create(); } + + MinecraftPlayer::factory()->count(50)->create(); } } diff --git a/database/seeders/PlayerWarningSeeder.php b/database/seeders/PlayerWarningSeeder.php index 70a55e2ca..2bd785720 100644 --- a/database/seeders/PlayerWarningSeeder.php +++ b/database/seeders/PlayerWarningSeeder.php @@ -4,7 +4,6 @@ use App\Models\Account; use App\Models\MinecraftPlayer; -use App\Models\MinecraftPlayerAlias; use App\Models\PlayerWarning; use Illuminate\Database\Seeder; @@ -14,7 +13,6 @@ public function run() { $staffPlayers = collect([ MinecraftPlayer::factory()->create(), - tap(MinecraftPlayer::factory()->create(), fn ($player) => MinecraftPlayerAlias::factory()->for($player)->create()), MinecraftPlayer::factory()->for(Account::factory())->create(), ]); diff --git a/database/seeders/ServerSeeder.php b/database/seeders/ServerSeeder.php deleted file mode 100644 index 36385a9ef..000000000 --- a/database/seeders/ServerSeeder.php +++ /dev/null @@ -1,20 +0,0 @@ -create([ - 'name' => 'Minecraft (Java)', - 'ip' => 'host.docker.internal', - 'ip_alias' => 'pcbmc.co', - 'port' => '25565', - 'web_port' => '8080', - ]); - } -} diff --git a/database/seeders/ShowcaseWarpSeeder.php b/database/seeders/ShowcaseWarpSeeder.php deleted file mode 100644 index 35f1f31ed..000000000 --- a/database/seeders/ShowcaseWarpSeeder.php +++ /dev/null @@ -1,16 +0,0 @@ -count(75) - ->create(); - } -} diff --git a/tests/Integration/Front/AccountMinecraftAccountTest.php b/tests/Integration/Front/AccountMinecraftAccountTest.php index 8ec7b9026..d8af74878 100644 --- a/tests/Integration/Front/AccountMinecraftAccountTest.php +++ b/tests/Integration/Front/AccountMinecraftAccountTest.php @@ -4,14 +4,12 @@ use App\Models\Account; use App\Models\MinecraftPlayer; -use App\Models\MinecraftPlayerAlias; use Tests\TestCase; class AccountMinecraftAccountTest extends TestCase { private Account $account; private MinecraftPlayer $mcPlayer; - private MinecraftPlayerAlias $mcPlayerAlias; protected function setUp(): void { @@ -22,10 +20,6 @@ protected function setUp(): void $this->mcPlayer = MinecraftPlayer::factory() ->for($this->account) ->create(); - - $this->mcPlayerAlias = MinecraftPlayerAlias::factory() - ->for($this->mcPlayer) - ->create(); } public function test_minecraft_account_shown_in_list() @@ -34,8 +28,7 @@ public function test_minecraft_account_shown_in_list() $this->get(route('front.account.games')) ->assertOk() - ->assertSee($this->mcPlayer->uuid) - ->assertSee($this->mcPlayerAlias->alias); + ->assertSee($this->mcPlayer->uuid); } public function test_minecraft_account_without_alias() From 37c6c8454f110e75f469100e565002d821409762 Mon Sep 17 00:00:00 2001 From: andyksaw Date: Sat, 2 Nov 2024 13:37:02 +0900 Subject: [PATCH 2/3] Fix method --- resources/views/admin/account/show.blade.php | 4 ++-- .../views/front/pages/account/account-game-accounts.blade.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/views/admin/account/show.blade.php b/resources/views/admin/account/show.blade.php index 66e302e6f..7e78ceb88 100644 --- a/resources/views/admin/account/show.blade.php +++ b/resources/views/admin/account/show.blade.php @@ -261,10 +261,10 @@ class="inline" - @if($player->aliases()->count() == 0) + @if($player->alias === null) Unknown @else - {{ $player->aliases->last()->alias }} + {{ $player->alias }} @endempty {{ $player->uuid }} diff --git a/resources/views/front/pages/account/account-game-accounts.blade.php b/resources/views/front/pages/account/account-game-accounts.blade.php index 849cd9f38..d9ca926ca 100644 --- a/resources/views/front/pages/account/account-game-accounts.blade.php +++ b/resources/views/front/pages/account/account-game-accounts.blade.php @@ -40,10 +40,10 @@ class="
- @if($mcAccount->aliases()->count() == 0) + @if($mcAccount->alias === null) No known name @else - {{ $mcAccount->aliases->last()->alias }} + {{ $mcAccount->alias }} @endempty
UUID: {{ $mcAccount->uuid }}
From 8b6ac8216259c673d04ce261967720341567456c Mon Sep 17 00:00:00 2001 From: andyksaw Date: Sat, 2 Nov 2024 13:45:38 +0900 Subject: [PATCH 3/3] Fix tests --- app/Http/Controllers/Panel/MinecraftPlayerController.php | 4 ++-- .../Panel/MinecraftPlayerLookupController.php | 9 +-------- .../Integration/Panel/PanelMinecraftPlayerLookupTest.php | 9 ++++----- tests/Integration/Panel/PanelMinecraftPlayerShowTest.php | 6 +----- 4 files changed, 8 insertions(+), 20 deletions(-) diff --git a/app/Http/Controllers/Panel/MinecraftPlayerController.php b/app/Http/Controllers/Panel/MinecraftPlayerController.php index 1bfadd07e..73112df8e 100644 --- a/app/Http/Controllers/Panel/MinecraftPlayerController.php +++ b/app/Http/Controllers/Panel/MinecraftPlayerController.php @@ -17,7 +17,7 @@ class MinecraftPlayerController extends WebController */ public function index() { - $minecraftPlayers = MinecraftPlayer::with(['account', 'aliases'])->paginate(50); + $minecraftPlayers = MinecraftPlayer::with(['account'])->paginate(50); return view('admin.minecraft-player.index')->with(compact('minecraftPlayers')); } @@ -64,7 +64,7 @@ public function store(Request $request, MojangPlayerApi $api) */ public function show(MinecraftPlayer $minecraftPlayer) { - $minecraftPlayer->load(['account', 'aliases', 'gamePlayerBans', 'gamePlayerBans.bannedPlayer.aliases', 'gamePlayerBans.bannerPlayer.aliases']); + $minecraftPlayer->load(['account', 'gamePlayerBans', 'gamePlayerBans.bannedPlayer', 'gamePlayerBans.bannerPlayer']); return view('admin.minecraft-player.show')->with(compact('minecraftPlayer')); } diff --git a/app/Http/Controllers/Panel/MinecraftPlayerLookupController.php b/app/Http/Controllers/Panel/MinecraftPlayerLookupController.php index 56a2249b9..f200a0819 100644 --- a/app/Http/Controllers/Panel/MinecraftPlayerLookupController.php +++ b/app/Http/Controllers/Panel/MinecraftPlayerLookupController.php @@ -37,14 +37,7 @@ private function lookupByStoredAlias($alias): ?MinecraftPlayer if (strlen($alias) < 3 || strlen($alias) > 16) { return null; } - - $player = MinecraftPlayer::where('alias', $alias)->first(); - - if ($player == null) { - return null; - } - - return $player; + return MinecraftPlayer::where('alias', 'like', '%'.$alias.'%')->first(); } /** diff --git a/tests/Integration/Panel/PanelMinecraftPlayerLookupTest.php b/tests/Integration/Panel/PanelMinecraftPlayerLookupTest.php index 679853f92..678a47707 100644 --- a/tests/Integration/Panel/PanelMinecraftPlayerLookupTest.php +++ b/tests/Integration/Panel/PanelMinecraftPlayerLookupTest.php @@ -43,7 +43,7 @@ public function test_lookup_player_by_undashed_uuid() public function test_lookup_player_by_dashed_uuid() { $uuid = $this->faker->uuid; - $mcPlayer = MinecraftPlayer::factory()->hasAliases(1)->create([ + $mcPlayer = MinecraftPlayer::factory()->create([ 'uuid' => str_replace('-', '', $uuid), ]); @@ -56,19 +56,18 @@ public function test_lookup_player_by_dashed_uuid() public function test_lookup_player_by_stored_alias() { - $mcPlayer = MinecraftPlayer::factory()->hasAliases(1)->create(); - $alias = $mcPlayer->aliases()->latest()->first(); + $mcPlayer = MinecraftPlayer::factory()->create(); $this->actingAs($this->admin) ->post(route('front.panel.minecraft-players.lookup'), [ - 'query' => $alias->alias, + 'query' => $mcPlayer->alias, ]) ->assertRedirect(route('front.panel.minecraft-players.show', $mcPlayer)); } public function test_lookup_player_by_non_stored_alias() { - $mcPlayer = MinecraftPlayer::factory()->hasAliases(1)->create(); + $mcPlayer = MinecraftPlayer::factory()->create(); $this->mock(MojangPlayerApi::class, function (MockInterface $mock) use ($mcPlayer) { $mock->shouldReceive('getUuidOf')->once()->andReturn( diff --git a/tests/Integration/Panel/PanelMinecraftPlayerShowTest.php b/tests/Integration/Panel/PanelMinecraftPlayerShowTest.php index 1ee42960a..f12604597 100644 --- a/tests/Integration/Panel/PanelMinecraftPlayerShowTest.php +++ b/tests/Integration/Panel/PanelMinecraftPlayerShowTest.php @@ -27,9 +27,8 @@ protected function setUp(): void public function test_ban_shown() { - $banningStaff = MinecraftPlayer::factory()->hasAliases(1)->create(); + $banningStaff = MinecraftPlayer::factory()->create(); $bannedPlayer = MinecraftPlayer::factory() - ->hasAliases(1) ->has(GamePlayerBan::factory()->bannedBy($banningStaff)) ->create(); @@ -42,7 +41,6 @@ public function test_ban_shown() public function test_ban_with_null_staff_shown() { $bannedPlayer = MinecraftPlayer::factory() - ->hasAliases(1) ->has(GamePlayerBan::factory()->bannedByConsole()) ->create(); @@ -55,7 +53,6 @@ public function test_ban_with_null_staff_shown() public function test_unauthorised_without_scope() { $bannedPlayer = MinecraftPlayer::factory() - ->hasAliases(1) ->has(GamePlayerBan::factory()->bannedByConsole()) ->create(); @@ -74,7 +71,6 @@ public function test_unauthorised_without_scope() public function test_unauthorised_without_panel_access() { $bannedPlayer = MinecraftPlayer::factory() - ->hasAliases(1) ->has(GamePlayerBan::factory()->bannedByConsole()) ->create();