From d1a556bcc8dca8e9acfaa99ff649409e5748d9a3 Mon Sep 17 00:00:00 2001 From: NiceAesth Date: Fri, 11 Aug 2023 01:56:36 +0300 Subject: [PATCH 01/10] Remove `doctrine/dbal` dependency --- composer.json | 1 - composer.lock | 345 +------------------------------------------------- 2 files changed, 1 insertion(+), 345 deletions(-) diff --git a/composer.json b/composer.json index 60a0494c242..dd2a5c18eae 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,6 @@ "require": { "anhskohbo/no-captcha": "^3.2", "chaseconey/laravel-datadog-helper": ">=1.2.0", - "doctrine/dbal": "^3.1", "egulias/email-validator": "*", "elasticsearch/elasticsearch": "^7.12.0", "ezyang/htmlpurifier": "*", diff --git a/composer.lock b/composer.lock index 4274163853c..43d3b54657b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b8bfdbdb79f8df1405bfa34ed0aa5e65", + "content-hash": "ee38dd4cd513b9c7ad68cbacc73eff6e", "packages": [ { "name": "anhskohbo/no-captcha", @@ -616,349 +616,6 @@ }, "time": "2022-10-27T11:44:00+00:00" }, - { - "name": "doctrine/cache", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/cache.git", - "reference": "1ca8f21980e770095a31456042471a57bc4c68fb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/1ca8f21980e770095a31456042471a57bc4c68fb", - "reference": "1ca8f21980e770095a31456042471a57bc4c68fb", - "shasum": "" - }, - "require": { - "php": "~7.1 || ^8.0" - }, - "conflict": { - "doctrine/common": ">2.2,<2.4" - }, - "require-dev": { - "cache/integration-tests": "dev-master", - "doctrine/coding-standard": "^9", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "psr/cache": "^1.0 || ^2.0 || ^3.0", - "symfony/cache": "^4.4 || ^5.4 || ^6", - "symfony/var-exporter": "^4.4 || ^5.4 || ^6" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.", - "homepage": "https://www.doctrine-project.org/projects/cache.html", - "keywords": [ - "abstraction", - "apcu", - "cache", - "caching", - "couchdb", - "memcached", - "php", - "redis", - "xcache" - ], - "support": { - "issues": "https://github.com/doctrine/cache/issues", - "source": "https://github.com/doctrine/cache/tree/2.2.0" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcache", - "type": "tidelift" - } - ], - "time": "2022-05-20T20:07:39+00:00" - }, - { - "name": "doctrine/dbal", - "version": "3.6.4", - "source": { - "type": "git", - "url": "https://github.com/doctrine/dbal.git", - "reference": "19f0dec95edd6a3c3c5ff1d188ea94c6b7fc903f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/19f0dec95edd6a3c3c5ff1d188ea94c6b7fc903f", - "reference": "19f0dec95edd6a3c3c5ff1d188ea94c6b7fc903f", - "shasum": "" - }, - "require": { - "composer-runtime-api": "^2", - "doctrine/cache": "^1.11|^2.0", - "doctrine/deprecations": "^0.5.3|^1", - "doctrine/event-manager": "^1|^2", - "php": "^7.4 || ^8.0", - "psr/cache": "^1|^2|^3", - "psr/log": "^1|^2|^3" - }, - "require-dev": { - "doctrine/coding-standard": "12.0.0", - "fig/log-test": "^1", - "jetbrains/phpstorm-stubs": "2022.3", - "phpstan/phpstan": "1.10.14", - "phpstan/phpstan-strict-rules": "^1.5", - "phpunit/phpunit": "9.6.7", - "psalm/plugin-phpunit": "0.18.4", - "squizlabs/php_codesniffer": "3.7.2", - "symfony/cache": "^5.4|^6.0", - "symfony/console": "^4.4|^5.4|^6.0", - "vimeo/psalm": "4.30.0" - }, - "suggest": { - "symfony/console": "For helpful console commands such as SQL execution and import of files." - }, - "bin": [ - "bin/doctrine-dbal" - ], - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\DBAL\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - } - ], - "description": "Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.", - "homepage": "https://www.doctrine-project.org/projects/dbal.html", - "keywords": [ - "abstraction", - "database", - "db2", - "dbal", - "mariadb", - "mssql", - "mysql", - "oci8", - "oracle", - "pdo", - "pgsql", - "postgresql", - "queryobject", - "sasql", - "sql", - "sqlite", - "sqlserver", - "sqlsrv" - ], - "support": { - "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/3.6.4" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdbal", - "type": "tidelift" - } - ], - "time": "2023-06-15T07:40:12+00:00" - }, - { - "name": "doctrine/deprecations", - "version": "v1.1.1", - "source": { - "type": "git", - "url": "https://github.com/doctrine/deprecations.git", - "reference": "612a3ee5ab0d5dd97b7cf3874a6efe24325efac3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/612a3ee5ab0d5dd97b7cf3874a6efe24325efac3", - "reference": "612a3ee5ab0d5dd97b7cf3874a6efe24325efac3", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^9", - "phpstan/phpstan": "1.4.10 || 1.10.15", - "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "psalm/plugin-phpunit": "0.18.4", - "psr/log": "^1 || ^2 || ^3", - "vimeo/psalm": "4.30.0 || 5.12.0" - }, - "suggest": { - "psr/log": "Allows logging deprecations via PSR-3 logger implementation" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", - "homepage": "https://www.doctrine-project.org/", - "support": { - "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/v1.1.1" - }, - "time": "2023-06-03T09:27:29+00:00" - }, - { - "name": "doctrine/event-manager", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/event-manager.git", - "reference": "750671534e0241a7c50ea5b43f67e23eb5c96f32" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/event-manager/zipball/750671534e0241a7c50ea5b43f67e23eb5c96f32", - "reference": "750671534e0241a7c50ea5b43f67e23eb5c96f32", - "shasum": "" - }, - "require": { - "php": "^8.1" - }, - "conflict": { - "doctrine/common": "<2.9" - }, - "require-dev": { - "doctrine/coding-standard": "^10", - "phpstan/phpstan": "^1.8.8", - "phpunit/phpunit": "^9.5", - "vimeo/psalm": "^4.28" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Common\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - }, - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - } - ], - "description": "The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.", - "homepage": "https://www.doctrine-project.org/projects/event-manager.html", - "keywords": [ - "event", - "event dispatcher", - "event manager", - "event system", - "events" - ], - "support": { - "issues": "https://github.com/doctrine/event-manager/issues", - "source": "https://github.com/doctrine/event-manager/tree/2.0.0" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fevent-manager", - "type": "tidelift" - } - ], - "time": "2022-10-12T20:59:15+00:00" - }, { "name": "doctrine/inflector", "version": "2.0.8", From af194bcdb17e080e5ee53d215918cbe3d6b7a349 Mon Sep 17 00:00:00 2001 From: NiceAesth Date: Fri, 11 Aug 2023 01:57:12 +0300 Subject: [PATCH 02/10] Update migrations for Laravel 10 --- ...05_10_080557_update_achievements_table.php | 10 ++++--- ...er_json_on_user_profile_customizations.php | 2 +- .../2020_01_20_031913_json_news_post_page.php | 12 ++++---- ..._update_beatmapsets_approvedby_id_type.php | 5 ++-- ...1035_upgrade_legacy_scoreids_to_bigint.php | 29 +++++++------------ 5 files changed, 27 insertions(+), 31 deletions(-) diff --git a/database/migrations/2016_05_10_080557_update_achievements_table.php b/database/migrations/2016_05_10_080557_update_achievements_table.php index 6e027cc97f6..67898a22dd3 100644 --- a/database/migrations/2016_05_10_080557_update_achievements_table.php +++ b/database/migrations/2016_05_10_080557_update_achievements_table.php @@ -30,8 +30,9 @@ public function up() $table->string('image', 50)->nullable()->change(); }); - // DBAL, which is used to execute `change()`, doesn't support `mediumInteger`. - DB::statement('ALTER TABLE osu_achievements MODIFY achievement_id MEDIUMINT UNSIGNED NOT NULL'); + Schema::table('osu_achievements', function ($table) { + $table->mediumInteger('achievement_id')->unsigned()->change(); + }); } /** @@ -47,7 +48,8 @@ public function down() $table->string('image', 50)->change(); }); - // `mediumIncrements` requires unsupported `mediumInteger`. - DB::statement('ALTER TABLE osu_achievements MODIFY achievement_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT'); + Schema::table('osu_achievements', function ($table) { + $table->mediumIncrements('achievement_id')->unsigned()->change(); + }); } } diff --git a/database/migrations/2017_02_06_083745_nullable_cover_json_on_user_profile_customizations.php b/database/migrations/2017_02_06_083745_nullable_cover_json_on_user_profile_customizations.php index 4128e602752..22b8b0567ab 100644 --- a/database/migrations/2017_02_06_083745_nullable_cover_json_on_user_profile_customizations.php +++ b/database/migrations/2017_02_06_083745_nullable_cover_json_on_user_profile_customizations.php @@ -18,7 +18,7 @@ public function up() Schema::table('user_profile_customizations', function ($table) { $table->dateTime('created_at')->nullable(false)->useCurrent()->change(); $table->dateTime('updated_at')->nullable(false)->useCurrent()->change(); - $table->text('cover_json')->nullable()->default('NULL')->change(); + $table->text('cover_json')->nullable(true)->change(); }); } diff --git a/database/migrations/2020_01_20_031913_json_news_post_page.php b/database/migrations/2020_01_20_031913_json_news_post_page.php index eb015913161..c771f43a8da 100644 --- a/database/migrations/2020_01_20_031913_json_news_post_page.php +++ b/database/migrations/2020_01_20_031913_json_news_post_page.php @@ -14,9 +14,9 @@ class JsonNewsPostPage extends Migration */ public function up() { - // DBAL (2.10.0) can't migrate to JSON datatype. - // It only creates TEXT with DC2Type:json as comment. - DB::statement('ALTER TABLE news_posts MODIFY page JSON'); + Schema::table('news_posts', function ($table) { + $table->json('page')->change(); + }); } /** @@ -26,8 +26,8 @@ public function up() */ public function down() { - // DBAL (2.10.0) can't migrate from JSON datatype. - // It explodes at unrecognized JSON datatype. - DB::statement('ALTER TABLE news_posts MODIFY page TEXT'); + Schema::table('news_posts', function ($table) { + $table->text('page')->change(); + }); } } diff --git a/database/migrations/2022_05_16_114745_update_beatmapsets_approvedby_id_type.php b/database/migrations/2022_05_16_114745_update_beatmapsets_approvedby_id_type.php index d0bac74aade..50911d576a8 100644 --- a/database/migrations/2022_05_16_114745_update_beatmapsets_approvedby_id_type.php +++ b/database/migrations/2022_05_16_114745_update_beatmapsets_approvedby_id_type.php @@ -28,7 +28,8 @@ public function up() */ public function down() { - // DBAL, which is used to execute `change()`, doesn't support `mediumInteger`. - DB::statement('ALTER TABLE osu_beatmapsets MODIFY approvedby_id MEDIUMINT UNSIGNED DEFAULT NULL'); + Schema::table('osu_beatmapsets', function (Blueprint $table) { + $table->mediumInteger('approvedby_id')->unsigned()->nullable()->change(); + }); } }; diff --git a/database/migrations/2022_09_09_011035_upgrade_legacy_scoreids_to_bigint.php b/database/migrations/2022_09_09_011035_upgrade_legacy_scoreids_to_bigint.php index 657efe73898..510c1874245 100644 --- a/database/migrations/2022_09_09_011035_upgrade_legacy_scoreids_to_bigint.php +++ b/database/migrations/2022_09_09_011035_upgrade_legacy_scoreids_to_bigint.php @@ -27,13 +27,12 @@ public function up() $table->bigInteger('score_id')->unsigned()->default(0)->change(); }); - Schema::table("osu_scores{$modeSuffix}_high", function (Blueprint $table) { - $table->bigIncrements('score_id')->change(); - }); - Schema::table("osu_scores{$modeSuffix}", function (Blueprint $table) { - $table->bigIncrements('score_id')->change(); - }); + // Laravel bigIncrements() is always a primary key, which causes issues with the existing primary key. + + DB::statement("ALTER TABLE `osu_scores{$modeSuffix}_high` MODIFY `score_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT"); + + DB::statement("ALTER TABLE `osu_scores{$modeSuffix}` MODIFY `score_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT"); } Schema::table('osu_user_reports', function (Blueprint $table) { @@ -61,24 +60,18 @@ public function down() $table->integer('score_id')->unsigned()->default(0)->change(); }); - Schema::table("osu_scores{$modeSuffix}_high", function (Blueprint $table) { - $table->increments('score_id')->change(); - }); + // Workaround for same issue with increments() as above. + + DB::statement("ALTER TABLE `osu_scores{$modeSuffix}_high` MODIFY `score_id` INT UNSIGNED NOT NULL AUTO_INCREMENT"); } // osu_scores remains as BIGINT - Schema::table('osu_scores_fruits', function (Blueprint $table) { - $table->increments('score_id')->change(); - }); + DB::statement("ALTER TABLE `osu_scores_fruits` MODIFY `score_id` INT UNSIGNED NOT NULL AUTO_INCREMENT"); - Schema::table('osu_scores_taiko', function (Blueprint $table) { - $table->increments('score_id')->change(); - }); + DB::statement("ALTER TABLE `osu_scores_taiko` MODIFY `score_id` INT UNSIGNED NOT NULL AUTO_INCREMENT"); - Schema::table('osu_scores_mania', function (Blueprint $table) { - $table->increments('score_id')->change(); - }); + DB::statement("ALTER TABLE `osu_scores_mania` MODIFY `score_id` INT UNSIGNED NOT NULL AUTO_INCREMENT"); Schema::table('osu_user_reports', function (Blueprint $table) { $table->integer('score_id')->unsigned()->default(0)->change(); From 5ebe0d7a29cee5a7457021e3d3b0a86ac2acddf7 Mon Sep 17 00:00:00 2001 From: NiceAesth Date: Fri, 11 Aug 2023 02:12:42 +0300 Subject: [PATCH 03/10] Remove default for nullable type in `contest_entries` --- .../2017_01_13_062704_nullable_entry_url_on_contest_entries.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/migrations/2017_01_13_062704_nullable_entry_url_on_contest_entries.php b/database/migrations/2017_01_13_062704_nullable_entry_url_on_contest_entries.php index 60ec6b0e48e..b891b10b911 100644 --- a/database/migrations/2017_01_13_062704_nullable_entry_url_on_contest_entries.php +++ b/database/migrations/2017_01_13_062704_nullable_entry_url_on_contest_entries.php @@ -17,7 +17,7 @@ class NullableEntryUrlOnContestEntries extends Migration public function up() { Schema::table('contest_entries', function (Blueprint $table) { - $table->string('entry_url')->nullable()->default('NULL')->change(); + $table->string('entry_url')->nullable(true)->change(); }); } From 81356a3ec1a6aaf1acb233e6605055aa880d2a0c Mon Sep 17 00:00:00 2001 From: NiceAesth Date: Fri, 11 Aug 2023 12:53:40 +0300 Subject: [PATCH 04/10] Fix `mediumIncrements()` down migration primary key conflict --- .../2016_05_10_080557_update_achievements_table.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/database/migrations/2016_05_10_080557_update_achievements_table.php b/database/migrations/2016_05_10_080557_update_achievements_table.php index 67898a22dd3..f1330ff0740 100644 --- a/database/migrations/2016_05_10_080557_update_achievements_table.php +++ b/database/migrations/2016_05_10_080557_update_achievements_table.php @@ -48,8 +48,8 @@ public function down() $table->string('image', 50)->change(); }); - Schema::table('osu_achievements', function ($table) { - $table->mediumIncrements('achievement_id')->unsigned()->change(); - }); + // Laravel mediumIncrements() always specifies primary key, causing conflicts. + + DB::statement('ALTER TABLE osu_achievements MODIFY achievement_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT'); } } From 5e2634b47999a1f34f09e1c7c48235a8b0d7b259 Mon Sep 17 00:00:00 2001 From: NiceAesth Date: Fri, 11 Aug 2023 12:54:10 +0300 Subject: [PATCH 05/10] Laravel default() is '1'. Changed to default(''). --- ...83745_nullable_cover_json_on_user_profile_customizations.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/migrations/2017_02_06_083745_nullable_cover_json_on_user_profile_customizations.php b/database/migrations/2017_02_06_083745_nullable_cover_json_on_user_profile_customizations.php index 22b8b0567ab..fe75e4ddd2a 100644 --- a/database/migrations/2017_02_06_083745_nullable_cover_json_on_user_profile_customizations.php +++ b/database/migrations/2017_02_06_083745_nullable_cover_json_on_user_profile_customizations.php @@ -34,7 +34,7 @@ public function down() ->update(['cover_json' => '']); Schema::table('user_profile_customizations', function ($table) { - $table->text('cover_json')->nullable(false)->default()->change(); + $table->text('cover_json')->nullable(false)->default('')->change(); }); } } From 5fc7563099562da525f11247d40ddb4d3d69388f Mon Sep 17 00:00:00 2001 From: NiceAesth Date: Fri, 11 Aug 2023 12:54:25 +0300 Subject: [PATCH 06/10] Drop foreign keys before dropping index --- .../2018_04_06_081112_unique_beatmapset_discussion_votes.php | 1 + .../2019_08_07_103120_add_index_to_beatmap_discussion.php | 1 + 2 files changed, 2 insertions(+) diff --git a/database/migrations/2018_04_06_081112_unique_beatmapset_discussion_votes.php b/database/migrations/2018_04_06_081112_unique_beatmapset_discussion_votes.php index 44124f5f5f8..4b0382f7be6 100644 --- a/database/migrations/2018_04_06_081112_unique_beatmapset_discussion_votes.php +++ b/database/migrations/2018_04_06_081112_unique_beatmapset_discussion_votes.php @@ -28,6 +28,7 @@ public function up() public function down() { Schema::table('beatmap_discussion_votes', function ($table) { + $table->dropForeign(['beatmap_discussion_id']); $table->dropUnique('beatmap_discussion_votes_beatmap_discussion_id_user_id_unique'); }); } diff --git a/database/migrations/2019_08_07_103120_add_index_to_beatmap_discussion.php b/database/migrations/2019_08_07_103120_add_index_to_beatmap_discussion.php index f2584300e82..70c1e997755 100644 --- a/database/migrations/2019_08_07_103120_add_index_to_beatmap_discussion.php +++ b/database/migrations/2019_08_07_103120_add_index_to_beatmap_discussion.php @@ -29,6 +29,7 @@ public function up() public function down() { Schema::table('beatmap_discussions', function (Blueprint $table) { + $table->dropForeign(['user_id']); $table->dropIndex(['user_id', 'updated_at']); }); } From 285b8116b63c2c487fa92c9f64997ec29fb8597c Mon Sep 17 00:00:00 2001 From: NiceAesth Date: Mon, 14 Aug 2023 15:33:56 +0300 Subject: [PATCH 07/10] Enable `nullable()` explicitly for `default(null)` --- .../migrations/2020_05_15_083037_sync_structure.php | 12 ++++++------ ...9_09_011035_upgrade_legacy_scoreids_to_bigint.php | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/database/migrations/2020_05_15_083037_sync_structure.php b/database/migrations/2020_05_15_083037_sync_structure.php index 0814137955d..2fd473c0353 100644 --- a/database/migrations/2020_05_15_083037_sync_structure.php +++ b/database/migrations/2020_05_15_083037_sync_structure.php @@ -153,7 +153,7 @@ public function up() $table->integer('user_id')->unsigned()->nullable(false)->default(0)->change(); }); Schema::table('github_users', function (Blueprint $table) { - $table->integer('user_id')->unsigned()->default(null)->change(); + $table->integer('user_id')->unsigned()->nullable()->default(null)->change(); }); Schema::table('multiplayer_rooms', function (Blueprint $table) { $table->integer('user_id')->unsigned()->nullable(false)->default(0)->change(); @@ -171,7 +171,7 @@ public function up() }); DB::statement('ALTER TABLE notifications CHANGE source_user_id source_user_id int unsigned DEFAULT NULL'); Schema::table('oauth_access_tokens', function (Blueprint $table) { - $table->integer('user_id')->unsigned()->default(null)->change(); + $table->integer('user_id')->unsigned()->nullable()->default(null)->change(); $table->dropIndex('oauth_access_tokens_expires_at_index'); $table->index('expires_at'); }); @@ -179,7 +179,7 @@ public function up() $table->integer('user_id')->unsigned()->nullable(false)->default(0)->change(); }); Schema::table('oauth_clients', function (Blueprint $table) { - $table->integer('user_id')->unsigned()->default(null)->change(); + $table->integer('user_id')->unsigned()->nullable()->default(null)->change(); }); Schema::table('osu_apikeys', function (Blueprint $table) { $table->string('app_url', 512)->nullable(false)->default('')->change(); @@ -212,7 +212,7 @@ public function up() $table->integer('user_id')->unsigned()->nullable(false)->default(0)->change(); $table->integer('playcount')->unsigned()->nullable(false)->default(0)->change(); $table->integer('passcount')->unsigned()->nullable(false)->default(0)->change(); - $table->tinyInteger('score_version')->nullablee(false)->default(1)->after('youtube_preview'); + $table->tinyInteger('score_version')->nullable(false)->default(1)->after('youtube_preview'); }); DB::statement('ALTER TABLE osu_beatmapsets CHANGE bpm bpm float NOT NULL DEFAULT 0'); DB::statement('ALTER TABLE osu_beatmapsets CHANGE rating rating float unsigned NOT NULL DEFAULT 0'); @@ -221,7 +221,7 @@ public function up() Schema::table('osu_beatmapsets', function (Blueprint $table) { $table->integer('user_id')->unsigned()->nullable(false)->default(0)->change(); $table->integer('play_count')->unsigned()->nullable(false)->default(0)->change(); - $table->string('difficulty_names', 2048)->default(null)->change(); + $table->string('difficulty_names', 2048)->nullable()->default(null)->change(); $table->string('storyboard_hash', 32)->nullable(); }); DB::statement('ALTER TABLE osu_builds CHANGE hash hash binary(16) DEFAULT NULL AFTER version'); @@ -405,7 +405,7 @@ public function up() }); Schema::table('user_contest_entries', function (Blueprint $table) { $table->integer('user_id')->unsigned()->nullable(false)->default(0)->change(); - $table->boolean('show_in_client')->nullable(true)->default(0)->change(); + $table->boolean('show_in_client')->nullable()->default(0)->change(); }); Schema::table('user_notifications', function (Blueprint $table) { $table->integer('user_id')->unsigned()->nullable(false)->default(0)->change(); diff --git a/database/migrations/2022_09_09_011035_upgrade_legacy_scoreids_to_bigint.php b/database/migrations/2022_09_09_011035_upgrade_legacy_scoreids_to_bigint.php index 510c1874245..2e9f3e91747 100644 --- a/database/migrations/2022_09_09_011035_upgrade_legacy_scoreids_to_bigint.php +++ b/database/migrations/2022_09_09_011035_upgrade_legacy_scoreids_to_bigint.php @@ -67,11 +67,11 @@ public function down() // osu_scores remains as BIGINT - DB::statement("ALTER TABLE `osu_scores_fruits` MODIFY `score_id` INT UNSIGNED NOT NULL AUTO_INCREMENT"); + DB::statement('ALTER TABLE `osu_scores_fruits` MODIFY `score_id` INT UNSIGNED NOT NULL AUTO_INCREMENT'); - DB::statement("ALTER TABLE `osu_scores_taiko` MODIFY `score_id` INT UNSIGNED NOT NULL AUTO_INCREMENT"); + DB::statement('ALTER TABLE `osu_scores_taiko` MODIFY `score_id` INT UNSIGNED NOT NULL AUTO_INCREMENT'); - DB::statement("ALTER TABLE `osu_scores_mania` MODIFY `score_id` INT UNSIGNED NOT NULL AUTO_INCREMENT"); + DB::statement('ALTER TABLE `osu_scores_mania` MODIFY `score_id` INT UNSIGNED NOT NULL AUTO_INCREMENT'); Schema::table('osu_user_reports', function (Blueprint $table) { $table->integer('score_id')->unsigned()->default(0)->change(); From f1aa621584b00a54f71e3dd11d1fb9367448d380 Mon Sep 17 00:00:00 2001 From: NiceAesth Date: Mon, 14 Aug 2023 15:41:29 +0300 Subject: [PATCH 08/10] Nitpick: change to `nullable()` for consistency --- .../2017_01_13_062704_nullable_entry_url_on_contest_entries.php | 2 +- ...83745_nullable_cover_json_on_user_profile_customizations.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/database/migrations/2017_01_13_062704_nullable_entry_url_on_contest_entries.php b/database/migrations/2017_01_13_062704_nullable_entry_url_on_contest_entries.php index b891b10b911..34eee62faf7 100644 --- a/database/migrations/2017_01_13_062704_nullable_entry_url_on_contest_entries.php +++ b/database/migrations/2017_01_13_062704_nullable_entry_url_on_contest_entries.php @@ -17,7 +17,7 @@ class NullableEntryUrlOnContestEntries extends Migration public function up() { Schema::table('contest_entries', function (Blueprint $table) { - $table->string('entry_url')->nullable(true)->change(); + $table->string('entry_url')->nullable()->change(); }); } diff --git a/database/migrations/2017_02_06_083745_nullable_cover_json_on_user_profile_customizations.php b/database/migrations/2017_02_06_083745_nullable_cover_json_on_user_profile_customizations.php index fe75e4ddd2a..f3d146143b4 100644 --- a/database/migrations/2017_02_06_083745_nullable_cover_json_on_user_profile_customizations.php +++ b/database/migrations/2017_02_06_083745_nullable_cover_json_on_user_profile_customizations.php @@ -18,7 +18,7 @@ public function up() Schema::table('user_profile_customizations', function ($table) { $table->dateTime('created_at')->nullable(false)->useCurrent()->change(); $table->dateTime('updated_at')->nullable(false)->useCurrent()->change(); - $table->text('cover_json')->nullable(true)->change(); + $table->text('cover_json')->nullable()->change(); }); } From 63b8ad355059499cd4c53a3b12425b9314ebdd18 Mon Sep 17 00:00:00 2001 From: NiceAesth Date: Mon, 14 Aug 2023 17:17:59 +0300 Subject: [PATCH 09/10] Fix remaining nullable changes --- .../migrations/2020_01_20_031913_json_news_post_page.php | 4 ++-- database/migrations/2020_05_15_083037_sync_structure.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/database/migrations/2020_01_20_031913_json_news_post_page.php b/database/migrations/2020_01_20_031913_json_news_post_page.php index c771f43a8da..a85d50c2b1c 100644 --- a/database/migrations/2020_01_20_031913_json_news_post_page.php +++ b/database/migrations/2020_01_20_031913_json_news_post_page.php @@ -15,7 +15,7 @@ class JsonNewsPostPage extends Migration public function up() { Schema::table('news_posts', function ($table) { - $table->json('page')->change(); + $table->json('page')->nullable()->change(); }); } @@ -27,7 +27,7 @@ public function up() public function down() { Schema::table('news_posts', function ($table) { - $table->text('page')->change(); + $table->text('page')->nullable()->change(); }); } } diff --git a/database/migrations/2020_05_15_083037_sync_structure.php b/database/migrations/2020_05_15_083037_sync_structure.php index 2fd473c0353..3649bbb1b64 100644 --- a/database/migrations/2020_05_15_083037_sync_structure.php +++ b/database/migrations/2020_05_15_083037_sync_structure.php @@ -76,10 +76,10 @@ public function up() $table->integer('user_id')->unsigned()->nullable(false)->default(0)->change(); }); Schema::table('beatmap_discussions', function (Blueprint $table) { - $table->integer('user_id')->unsigned()->change(); - $table->integer('resolver_id')->unsigned()->change(); - $table->integer('deleted_by_id')->unsigned()->change(); - $table->integer('kudosu_denied_by_id')->unsigned()->change(); + $table->integer('user_id')->unsigned()->nullable()->change(); + $table->integer('resolver_id')->unsigned()->nullable()->change(); + $table->integer('deleted_by_id')->unsigned()->nullable()->change(); + $table->integer('kudosu_denied_by_id')->unsigned()->nullable()->change(); }); DB::statement('ALTER TABLE beatmapset_events CHANGE user_id user_id int unsigned DEFAULT NULL'); Schema::table('beatmapset_events', function (Blueprint $table) { From 9feee592e3a3ca513f3886898054c8e863dad406 Mon Sep 17 00:00:00 2001 From: NiceAesth Date: Wed, 16 Aug 2023 03:42:14 +0300 Subject: [PATCH 10/10] Add missing `nullable()` --- database/migrations/2020_05_15_083037_sync_structure.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database/migrations/2020_05_15_083037_sync_structure.php b/database/migrations/2020_05_15_083037_sync_structure.php index 3649bbb1b64..e3c2e8397fb 100644 --- a/database/migrations/2020_05_15_083037_sync_structure.php +++ b/database/migrations/2020_05_15_083037_sync_structure.php @@ -93,7 +93,7 @@ public function up() $table->integer('user_id')->unsigned()->default(0)->change(); }); Schema::table('changelog_entries', function (Blueprint $table) { - $table->integer('github_user_id')->unsigned()->change(); + $table->integer('github_user_id')->unsigned()->nullable()->change(); }); Schema::table('comment_votes', function (Blueprint $table) { $table->integer('user_id')->unsigned()->default(0)->change(); @@ -102,7 +102,7 @@ public function up() DB::statement('ALTER TABLE comments CHANGE edited_by_id edited_by_id int unsigned DEFAULT NULL'); DB::statement('ALTER TABLE comments CHANGE deleted_by_id deleted_by_id int unsigned DEFAULT NULL'); Schema::table('contest_entries', function (Blueprint $table) { - $table->integer('user_id')->unsigned()->change(); + $table->integer('user_id')->unsigned()->nullable()->change(); $table->dropForeign('contest_entries_contest_id_foreign'); $table->foreign('contest_id') ->references('id')