evvo/tidb-laravel

Better TiDb support for Laravel

0.1 2018-11-11 13:59 UTC

This package is not auto-updated.

Last update: 2024-09-24 18:41:00 UTC


README

Better TiDb support for Laravel

Install the latest version of the library:

composer require evvo/tidb-laravel:0.1

Laravel 5.5+ should be able to autodiscover the package's service provider.

Set the database driver for your database connection to be 'tidb' in config/database.php - for example:

'mysql' => [
            'driver' => 'tidb',
            'host' => env('DB_HOST', '127.0.0.1'),
            ...

Notes on some of the differences between MySQL and TiDb

TiDb does not support multiple column updates in a single command - for example, this is not supported:

Schema::table('users', function (Blueprint $table) {
    $table->boolean('verified')->default(false);
    $table->string('name')->nullable();
});

but this will work fine:

Schema::table('users', function (Blueprint $table) {
    $table->boolean('verified')->default(false);
});

Schema::table('users', function (Blueprint $table) {
    $table->string('name')->nullable();
});