Monday 27 May 2019

MYSQL case insensitive

MYSQL case insensitive by default:
to get case sensitive record:


Laravel:


But this will still prevent writting to the column, if column has unique key constraint . Arecord is considered same as arecord
so
ALTER TABLE temp CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;

In laravel:
create migration 

    public function up()
    {
        // Need utf
        DB::statement("ALTER TABLE <mytable> CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin");
    }

https://stackoverflow.com/questions/1838185/mysql-column-to-utf8-bin
https://stackoverflow.com/questions/46587931/changing-the-collation-of-database-column-is-not-working-in-laravel-migrations


MYSQL default is case insesntive 
it is  $table->charset('utf8mb4');
            $table->collate('utf8mb4_unicode_ci'); 

https://github.com/laravel/framework/issues/8857

No comments:

Post a Comment