PHP code example of coolseven / laravel-migration-char-type
1. Go to this page and download the library: Download coolseven/laravel-migration-char-type library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
coolseven / laravel-migration-char-type example snippets
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();
});
}
}