coolseven / laravel-migration-char-type
Add Char Type For Laravel Migration
Installs: 107
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/coolseven/laravel-migration-char-type
Requires
- doctrine/dbal: ^2.9
- illuminate/database: ^6.0|^7.0|^8.0
This package is auto-updated.
Last update: 2025-09-15 23:02:42 UTC
README
Register Char Type To Doctrine Dbal library's types map , This package enables changing a column's type to char type when using laravel's migration schema
The solution is inspired by Muhammad Zamroni's article
Usage:
composer require coolseven/laravel-migration-char-type
<?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class ChangePrimaryKeyFromIntToCharOnUsersTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('users',function(Blueprint $table){ // before change : $table->bigIncrements('id'); $table->char('id',36)->change(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('users',function(Blueprint $table){ $table->bigIncrements('id')->change(); }); } }
TODO
- adding tests