forked from ppy/osu-web
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into drop-unused-columns
- Loading branch information
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
database/migrations/2023_10_24_122345_drop_id_from_user_profile_customizations.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
// 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. | ||
|
||
declare(strict_types=1); | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
Schema::table('user_profile_customizations', function (Blueprint $table) { | ||
$table->unsignedInteger('user_id')->nullable(false)->default(null)->change(); | ||
$table->dropColumn('id'); | ||
$table->primary('user_id'); | ||
$table->dropIndex('user_profile_customizations_user_id_unique'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
Schema::table('user_profile_customizations', function (Blueprint $table) { | ||
$table->unsignedInteger('user_id')->nullable(false)->default(0)->change(); | ||
$table->unique('user_id'); | ||
$table->dropPrimary('user_id'); | ||
}); | ||
|
||
Schema::table('user_profile_customizations', function (Blueprint $table) { | ||
$table->increments('id')->first(); | ||
}); | ||
} | ||
}; |