Checkout: minimize registration data
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
if (! Schema::hasColumn('users', 'username')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$driver = DB::getDriverName();
|
||||
|
||||
if ($driver === 'mysql') {
|
||||
DB::statement('ALTER TABLE users MODIFY username VARCHAR(255) NULL');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($driver === 'pgsql') {
|
||||
DB::statement('ALTER TABLE users ALTER COLUMN username TYPE VARCHAR(255)');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
if (! Schema::hasColumn('users', 'username')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$driver = DB::getDriverName();
|
||||
|
||||
if ($driver === 'mysql') {
|
||||
DB::statement('ALTER TABLE users MODIFY username VARCHAR(32) NULL');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($driver === 'pgsql') {
|
||||
DB::statement('ALTER TABLE users ALTER COLUMN username TYPE VARCHAR(32)');
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user