laravel-mysql-move-column maintained by daniel-de-wit
Laravel MySQL Move Column
A Laravel package for simplifying rearranging MySQL database columns.
Installation
You can install the package via composer:
composer require daniel-de-wit/laravel-mysql-move-column
The package is loaded using Package Discovery, when disabled read Manual Installation.
Usage
The method moveColumn is made available for moving a MySQl column to a new position.
<?php
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
return new class extends Migration
{
public function up(): void
{
Schema::table('users', function (Blueprint $table): void {
$table->moveColumn('name', 'id');
});
}
};
Manual Installation
When disabled, register the LaravelMySQLMoveColumnServiceProvider manually by adding it to your config/app.php
/*
* Package Service Providers...
*/
DanielDeWit\LaravelMySQLMoveColumnServiceProvider\Providers\LaravelMySQLMoveColumnServiceProvider::class,
Testing
composer test
Credits
License
The MIT License (MIT). Please see License File for more information.