Skip to content

Commit

Permalink
Remove encoding and non-compressed row format
Browse files Browse the repository at this point in the history
  • Loading branch information
nanaya committed Nov 13, 2023
1 parent ed285c7 commit 14d6fac
Show file tree
Hide file tree
Showing 19 changed files with 63 additions and 428 deletions.
372 changes: 38 additions & 334 deletions database/migrations/2015_01_01_133337_base_tables.php

Large diffs are not rendered by default.

10 changes: 2 additions & 8 deletions database/migrations/2015_01_01_133337_chat_base_tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

Expand All @@ -18,11 +19,8 @@ public function up()
$connection = DB::connection('mysql-chat');

$builder->create('channels', function (Blueprint $table) {
$table->charset = 'utf8mb4';

$table->increments('channel_id');
$column = $table->string('name', 50);
$column->charset = 'utf8mb4';
$table->string('name', 50);
$table->string('description', 256);
$table->timestamp('creation_time')->default(DB::raw('CURRENT_TIMESTAMP'));
$table->enum('type', ['Public', 'Private', 'Multiplayer', 'Spectator', 'Temporary'])->default('Temporary');
Expand All @@ -34,8 +32,6 @@ public function up()
$this->setRowFormat($connection, 'channels', 'DYNAMIC');

$builder->create('messages', function (Blueprint $table) {
$table->charset = 'utf8mb4';

$table->increments('message_id');
$table->integer('user_id')->unsigned();
$table->integer('channel_id')->unsigned();
Expand All @@ -49,8 +45,6 @@ public function up()
$this->setRowFormat($connection, 'messages', 'COMPRESSED');

$builder->create('messages_private', function (Blueprint $table) {
$table->charset = 'utf8mb4';

$table->increments('message_id');
$table->integer('user_id')->unsigned();
$table->integer('target_id')->unsigned();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ public function up()
}

Schema::create('phpbb_poll_votes', function ($table) {
$table->collation = 'utf8_bin';
$table->charset = 'utf8';

$table->mediumInteger('topic_id')->unsigned()->default(0);
$table->tinyInteger('poll_option_id')->default(0);
$table->mediumInteger('vote_user_id')->unsigned()->default(0);
Expand All @@ -31,8 +28,6 @@ public function up()
$table->index('vote_user_id', 'vote_user_id');
$table->index('vote_user_ip', 'vote_user_ip');
});

DB::statement('ALTER TABLE phpbb_poll_votes ROW_FORMAT=DYNAMIC');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ public function up()
}

Schema::create('phpbb_poll_options', function ($table) {
$table->collation = 'utf8_bin';
$table->charset = 'utf8';

$table->tinyInteger('poll_option_id')->default(0);
$table->mediumInteger('topic_id')->unsigned()->default(0);
$table->text('poll_option_text');
Expand All @@ -30,8 +27,6 @@ public function up()
$table->index('poll_option_id', 'poll_opt_id');
$table->index('topic_id', 'topic_id');
});

DB::statement('ALTER TABLE phpbb_poll_options ROW_FORMAT=DYNAMIC');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ public function up()
}

Schema::create('osu_banchostats', function (Blueprint $table) {
$table->charset = 'utf8';
$table->collation = 'utf8_general_ci';

$table->increments('banchostats_id');
$table->smallInteger('users_irc');
$table->smallInteger('users_osu');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ class CreateArtistTables extends Migration
public function up()
{
Schema::create('labels', function (Blueprint $table) {
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_general_ci';

$table->increments('id');
$table->string('name');
$table->text('description');
Expand All @@ -33,9 +30,6 @@ public function up()
});

Schema::create('artists', function (Blueprint $table) {
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_general_ci';

$table->increments('id');
$table->string('name');
$table->text('description');
Expand All @@ -57,9 +51,6 @@ public function up()
});

Schema::create('artist_tracks', function (Blueprint $table) {
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_general_ci';

$table->increments('id');
$table->integer('artist_id')->unsigned()->nullable();
$table->foreign('artist_id')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ class CreateContestTables extends Migration
public function up()
{
Schema::create('contests', function (Blueprint $table) {
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_general_ci';

$table->increments('id');
$table->string('name');
$table->text('description');
Expand All @@ -32,9 +29,6 @@ public function up()
});

Schema::create('contest_entries', function (Blueprint $table) {
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_general_ci';

$table->increments('id');
$table->string('name');
$table->string('masked_name');
Expand All @@ -51,9 +45,6 @@ public function up()
});

Schema::create('contest_votes', function (Blueprint $table) {
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_general_ci';

$table->increments('id');

$table->integer('contest_id')->unsigned();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ public function up()
}

Schema::create('phpbb_sessions', function ($table) {
$table->collation = 'utf8_bin';
$table->charset = 'utf8';

$table->string('session_id', 32)->default('');
$table->mediumInteger('session_user_id')->unsigned()->default(0);
$table->integer('session_last_visit')->unsigned()->default(0);
Expand All @@ -40,8 +37,6 @@ public function up()
$table->index(['session_autologin', 'session_time'], 'autologin_time_purge');
$table->index(['session_user_id', 'session_time'], 'session_user_id_time');
});

DB::statement('ALTER TABLE phpbb_sessions ROW_FORMAT=DYNAMIC');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ class CreateUserContestEntriesTable extends Migration
public function up()
{
Schema::create('user_contest_entries', function (Blueprint $table) {
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_general_ci';

$table->increments('id');

$table->string('original_filename');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ class CreateArtistAlbumsTable extends Migration
public function up()
{
Schema::create('artist_albums', function (Blueprint $table) {
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_general_ci';

$table->increments('id');
$table->integer('artist_id')->unsigned()->nullable();
$table->foreign('artist_id')
Expand Down
29 changes: 15 additions & 14 deletions database/migrations/2017_02_21_084403_mb4_forum_last_topic.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ class Mb4ForumLastTopic extends Migration
*/
public function up()
{
DB::statement("
ALTER TABLE phpbb_forums MODIFY forum_last_post_subject
VARCHAR(100)
NOT NULL
DEFAULT ''
COLLATE 'utf8mb4_bin'
");
// Not relevant anymore
// DB::statement("
// ALTER TABLE phpbb_forums MODIFY forum_last_post_subject
// VARCHAR(100)
// NOT NULL
// DEFAULT ''
// COLLATE 'utf8mb4_bin'
// ");
}

/**
Expand All @@ -30,12 +31,12 @@ public function up()
*/
public function down()
{
DB::statement("
ALTER TABLE phpbb_forums MODIFY forum_last_post_subject
VARCHAR(100)
NOT NULL
DEFAULT ''
COLLATE 'utf8_bin'
");
// DB::statement("
// ALTER TABLE phpbb_forums MODIFY forum_last_post_subject
// VARCHAR(100)
// NOT NULL
// DEFAULT ''
// COLLATE 'utf8_bin'
// ");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ public function up()
}

Schema::create('osu_beatmappacks', function (Blueprint $table) {
$table->charset = 'utf8';
$table->collation = 'utf8_general_ci';

$table->smallInteger('pack_id', true);
$table->string('url', 1024);
$table->string('name', 255);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ public function up()
}

Schema::create('osu_beatmappacks_items', function (Blueprint $table) {
$table->charset = 'utf8';
$table->collation = 'utf8_general_ci';

$table->unsignedMediumInteger('item_id', true);
$table->unsignedSmallInteger('pack_id');
$table->unsignedMediumInteger('beatmapset_id');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ public function up()
}

Schema::create('osu_profile_banners', function (Blueprint $table) {
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_general_ci';

$table->unsignedMediumInteger('banner_id', true);
$table->unsignedInteger('user_id');
$table->integer('tournament_id');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class FixLogsTableEncoding extends Migration
*/
public function up()
{
DB::statement("ALTER TABLE phpbb_log MODIFY log_data MEDIUMTEXT NOT NULL COLLATE 'utf8mb4_bin'");
// Not relevant anymore
// DB::statement("ALTER TABLE phpbb_log MODIFY log_data MEDIUMTEXT NOT NULL COLLATE 'utf8mb4_bin'");
}

/**
Expand All @@ -24,6 +25,6 @@ public function up()
*/
public function down()
{
DB::statement("ALTER TABLE phpbb_log MODIFY log_data MEDIUMTEXT NOT NULL COLLATE 'utf8_bin'");
// DB::statement("ALTER TABLE phpbb_log MODIFY log_data MEDIUMTEXT NOT NULL COLLATE 'utf8_bin'");
}
}
8 changes: 1 addition & 7 deletions database/migrations/2017_10_10_082642_add_ip_bans.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ public function up()
}

Schema::create('osu_ip_bans', function ($table) {
$table->charset = 'utf8';
$table->collation = 'utf8_general_ci';

$column = $table->string('ip', 40)->primary()->default('');
$column->collation = 'utf8_bin';
$table->string('ip', 40)->primary()->default('');
$table->unsignedMediumInteger('user_id')->nullable();
$table->timestamp('timestamp')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
$table->integer('length')->default(72 * 3600);
Expand All @@ -33,8 +29,6 @@ public function up()
$table->index('user_id', 'user_id');
$table->index(['active', 'timestamp'], 'active');
});

DB::statement('ALTER TABLE osu_ip_bans ROW_FORMAT=DYNAMIC');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class FixUserSigEncoding extends Migration
*/
public function up()
{
DB::statement("ALTER TABLE phpbb_users MODIFY user_sig MEDIUMTEXT NOT NULL COLLATE 'utf8mb4_bin'");
// Not relevant anymore
// DB::statement("ALTER TABLE phpbb_users MODIFY user_sig MEDIUMTEXT NOT NULL COLLATE 'utf8mb4_bin'");
}

/**
Expand All @@ -24,6 +25,6 @@ public function up()
*/
public function down()
{
DB::statement("ALTER TABLE phpbb_users MODIFY user_sig MEDIUMTEXT NOT NULL COLLATE 'utf8_bin'");
// DB::statement("ALTER TABLE phpbb_users MODIFY user_sig MEDIUMTEXT NOT NULL COLLATE 'utf8_bin'");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ public function up()
}

Schema::create('phpbb_banlist', function (Blueprint $table) {
$table->charset = 'utf8';
$table->collation = 'utf8_bin';

$table->mediumIncrements('ban_id');
$table->unsignedMediumInteger('ban_userid')->default(0);
$table->string('ban_ip', 40)->default('');
Expand All @@ -39,8 +36,6 @@ public function up()
$table->index(['ban_email', 'ban_exclude'], 'ban_email');
$table->index(['ban_ip', 'ban_exclude'], 'ban_ip');
});

DB::statement('ALTER TABLE `phpbb_banlist` ROW_FORMAT=DYNAMIC;');
}

/**
Expand All @@ -50,6 +45,6 @@ public function up()
*/
public function down()
{
// no going back =)
Schema::drop('phpbb_banlist');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ class CreateOsuUserPerformanceRankHighest extends Migration
public function up()
{
Schema::create('osu_user_performance_rank_highest', function (Blueprint $table) {
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_general_ci';

$table->unsignedInteger('user_id');
$table->tinyInteger('mode');
$table->integer('rank')->default(0);
Expand All @@ -30,7 +27,6 @@ public function up()
});
DB::statement('
ALTER TABLE `osu_user_performance_rank_highest`
ROW_FORMAT=DYNAMIC
PARTITION BY RANGE (`mode`) (
PARTITION p0 VALUES LESS THAN (1),
PARTITION p1 VALUES LESS THAN (2),
Expand Down

0 comments on commit 14d6fac

Please sign in to comment.